// 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 Simplesat string

const (
	SimplesatSimplesat Simplesat = "simplesat"
)

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

type SourceSimplesat struct {
	APIKey string `json:"api_key"`
	// Date till when the sync should end
	EndDate *time.Time `json:"end_date,omitempty"`
	// Date from when the sync should start
	StartDate  *time.Time `json:"start_date,omitempty"`
	sourceType Simplesat  `const:"simplesat" json:"sourceType"`
}

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

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

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

func (o *SourceSimplesat) GetEndDate() *time.Time {
	if o == nil {
		return nil
	}
	return o.EndDate
}

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

func (o *SourceSimplesat) GetSourceType() Simplesat {
	return SimplesatSimplesat
}
