// 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"
	"time"
)

type Fastly string

const (
	FastlyFastly Fastly = "fastly"
)

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

type SourceFastly struct {
	// Your Fastly API token. You can generate this token in the Fastly web interface under Account Settings or via the Fastly API. Ensure the token has the appropriate scope for your use case.
	FastlyAPIToken string    `json:"fastly_api_token"`
	StartDate      time.Time `json:"start_date"`
	sourceType     Fastly    `const:"fastly" json:"sourceType"`
}

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

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

func (o *SourceFastly) GetFastlyAPIToken() string {
	if o == nil {
		return ""
	}
	return o.FastlyAPIToken
}

func (o *SourceFastly) GetStartDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartDate
}

func (o *SourceFastly) GetSourceType() Fastly {
	return FastlyFastly
}
