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

// SourceMailgunUpdateDomainRegionCode - Domain region code. 'EU' or 'US' are possible values. The default is 'US'.
type SourceMailgunUpdateDomainRegionCode string

const (
	SourceMailgunUpdateDomainRegionCodeUs SourceMailgunUpdateDomainRegionCode = "US"
	SourceMailgunUpdateDomainRegionCodeEu SourceMailgunUpdateDomainRegionCode = "EU"
)

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

type SourceMailgunUpdate struct {
	// Domain region code. 'EU' or 'US' are possible values. The default is 'US'.
	DomainRegion *SourceMailgunUpdateDomainRegionCode `default:"US" json:"domain_region"`
	// Primary account API key to access your Mailgun data.
	PrivateKey string `json:"private_key"`
	// UTC date and time in the format 2020-10-01 00:00:00. Any data before this date will not be replicated. If omitted, defaults to 3 days ago.
	StartDate *time.Time `json:"start_date,omitempty"`
}

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

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

func (o *SourceMailgunUpdate) GetDomainRegion() *SourceMailgunUpdateDomainRegionCode {
	if o == nil {
		return nil
	}
	return o.DomainRegion
}

func (o *SourceMailgunUpdate) GetPrivateKey() string {
	if o == nil {
		return ""
	}
	return o.PrivateKey
}

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