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

// SourceCastorEdcUpdateURLRegion - The url region given at time of registration
type SourceCastorEdcUpdateURLRegion string

const (
	SourceCastorEdcUpdateURLRegionUk SourceCastorEdcUpdateURLRegion = "uk"
	SourceCastorEdcUpdateURLRegionNl SourceCastorEdcUpdateURLRegion = "nl"
	SourceCastorEdcUpdateURLRegionUs SourceCastorEdcUpdateURLRegion = "us"
)

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

type SourceCastorEdcUpdate struct {
	// Visit `https://YOUR_REGION.castoredc.com/account/settings`
	ClientID string `json:"client_id"`
	// Visit `https://YOUR_REGION.castoredc.com/account/settings`
	ClientSecret string    `json:"client_secret"`
	StartDate    time.Time `json:"start_date"`
	// The url region given at time of registration
	URLRegion *SourceCastorEdcUpdateURLRegion `default:"uk" json:"url_region"`
}

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

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

func (o *SourceCastorEdcUpdate) GetClientID() string {
	if o == nil {
		return ""
	}
	return o.ClientID
}

func (o *SourceCastorEdcUpdate) GetClientSecret() string {
	if o == nil {
		return ""
	}
	return o.ClientSecret
}

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

func (o *SourceCastorEdcUpdate) GetURLRegion() *SourceCastorEdcUpdateURLRegion {
	if o == nil {
		return nil
	}
	return o.URLRegion
}
