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

type Ashby string

const (
	AshbyAshby Ashby = "ashby"
)

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

type SourceAshby struct {
	// The Ashby API Key, see <a href=\"https://developers.ashbyhq.com/reference/authentication\">doc</a> here.
	APIKey string `json:"api_key"`
	// UTC date and time in the format 2017-01-25T00:00:00Z. Any data before this date will not be replicated.
	StartDate  string `json:"start_date"`
	sourceType Ashby  `const:"ashby" json:"sourceType"`
}

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

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

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

func (o *SourceAshby) GetStartDate() string {
	if o == nil {
		return ""
	}
	return o.StartDate
}

func (o *SourceAshby) GetSourceType() Ashby {
	return AshbyAshby
}
