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

// SourceYousignUpdateSubdomain - The subdomain for the Yousign API environment, such as 'sandbox' or 'api'.
type SourceYousignUpdateSubdomain string

const (
	SourceYousignUpdateSubdomainAPISandbox SourceYousignUpdateSubdomain = "api-sandbox"
	SourceYousignUpdateSubdomainAPI        SourceYousignUpdateSubdomain = "api"
)

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

type SourceYousignUpdate struct {
	// API key or access token
	APIKey string `json:"api_key"`
	// Limit for each response objects
	Limit     *string   `default:"10" json:"limit"`
	StartDate time.Time `json:"start_date"`
	// The subdomain for the Yousign API environment, such as 'sandbox' or 'api'.
	Subdomain *SourceYousignUpdateSubdomain `default:"api" json:"subdomain"`
}

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

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

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

func (o *SourceYousignUpdate) GetLimit() *string {
	if o == nil {
		return nil
	}
	return o.Limit
}

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

func (o *SourceYousignUpdate) GetSubdomain() *SourceYousignUpdateSubdomain {
	if o == nil {
		return nil
	}
	return o.Subdomain
}
