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

const (
	FreeAgentConnectorFreeAgentConnector FreeAgentConnector = "free-agent-connector"
)

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

type SourceFreeAgentConnector struct {
	ClientID            string             `json:"client_id"`
	ClientRefreshToken2 string             `json:"client_refresh_token_2"`
	ClientSecret        string             `json:"client_secret"`
	PayrollYear         *float64           `json:"payroll_year,omitempty"`
	UpdatedSince        *time.Time         `json:"updated_since,omitempty"`
	sourceType          FreeAgentConnector `const:"free-agent-connector" json:"sourceType"`
}

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

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

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

func (o *SourceFreeAgentConnector) GetClientRefreshToken2() string {
	if o == nil {
		return ""
	}
	return o.ClientRefreshToken2
}

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

func (o *SourceFreeAgentConnector) GetPayrollYear() *float64 {
	if o == nil {
		return nil
	}
	return o.PayrollYear
}

func (o *SourceFreeAgentConnector) GetUpdatedSince() *time.Time {
	if o == nil {
		return nil
	}
	return o.UpdatedSince
}

func (o *SourceFreeAgentConnector) GetSourceType() FreeAgentConnector {
	return FreeAgentConnectorFreeAgentConnector
}
