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

const (
	CallrailCallrail Callrail = "callrail"
)

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

type SourceCallrail struct {
	// Account ID
	AccountID string `json:"account_id"`
	// API access key
	APIKey string `json:"api_key"`
	// Start getting data from that date.
	StartDate  string   `json:"start_date"`
	sourceType Callrail `const:"callrail" json:"sourceType"`
}

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

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

func (o *SourceCallrail) GetAccountID() string {
	if o == nil {
		return ""
	}
	return o.AccountID
}

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

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

func (o *SourceCallrail) GetSourceType() Callrail {
	return CallrailCallrail
}
