// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package shared

import (
	"encoding/json"
	"fmt"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/internal/utils"
)

type Statuspage string

const (
	StatuspageStatuspage Statuspage = "statuspage"
)

func (e Statuspage) ToPointer() *Statuspage {
	return &e
}
func (e *Statuspage) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "statuspage":
		*e = Statuspage(v)
		return nil
	default:
		return fmt.Errorf("invalid value for Statuspage: %v", v)
	}
}

type SourceStatuspage struct {
	// Your API Key. See <a href="https://developer.statuspage.io/#section/Authentication/api_key">here</a>.
	APIKey     string     `json:"api_key"`
	sourceType Statuspage `const:"statuspage" json:"sourceType"`
}

func (s SourceStatuspage) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(s, "", false)
}

func (s *SourceStatuspage) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &s, "", false, false); err != nil {
		return err
	}
	return nil
}

func (o *SourceStatuspage) GetAPIKey() string {
	if o == nil {
		return ""
	}
	return o.APIKey
}

func (o *SourceStatuspage) GetSourceType() Statuspage {
	return StatuspageStatuspage
}
