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

// SourceBabelforceRegion - Babelforce region
type SourceBabelforceRegion string

const (
	SourceBabelforceRegionServices    SourceBabelforceRegion = "services"
	SourceBabelforceRegionUsEast      SourceBabelforceRegion = "us-east"
	SourceBabelforceRegionApSoutheast SourceBabelforceRegion = "ap-southeast"
)

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

type Babelforce string

const (
	BabelforceBabelforce Babelforce = "babelforce"
)

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

type SourceBabelforce struct {
	// The Babelforce access key ID
	AccessKeyID string `json:"access_key_id"`
	// The Babelforce access token
	AccessToken string `json:"access_token"`
	// Timestamp in Unix the replication from Babelforce API will start from. For example 1651363200 which corresponds to 2022-05-01 00:00:00.
	DateCreatedFrom *int64 `json:"date_created_from,omitempty"`
	// Timestamp in Unix the replication from Babelforce will be up to. For example 1651363200 which corresponds to 2022-05-01 00:00:00.
	DateCreatedTo *int64 `json:"date_created_to,omitempty"`
	// Babelforce region
	Region     *SourceBabelforceRegion `default:"services" json:"region"`
	sourceType Babelforce              `const:"babelforce" json:"sourceType"`
}

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

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

func (o *SourceBabelforce) GetAccessKeyID() string {
	if o == nil {
		return ""
	}
	return o.AccessKeyID
}

func (o *SourceBabelforce) GetAccessToken() string {
	if o == nil {
		return ""
	}
	return o.AccessToken
}

func (o *SourceBabelforce) GetDateCreatedFrom() *int64 {
	if o == nil {
		return nil
	}
	return o.DateCreatedFrom
}

func (o *SourceBabelforce) GetDateCreatedTo() *int64 {
	if o == nil {
		return nil
	}
	return o.DateCreatedTo
}

func (o *SourceBabelforce) GetRegion() *SourceBabelforceRegion {
	if o == nil {
		return nil
	}
	return o.Region
}

func (o *SourceBabelforce) GetSourceType() Babelforce {
	return BabelforceBabelforce
}
