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

// SourceAmazonSqsAWSRegion - AWS Region of the SQS Queue
type SourceAmazonSqsAWSRegion string

const (
	SourceAmazonSqsAWSRegionAfSouth1     SourceAmazonSqsAWSRegion = "af-south-1"
	SourceAmazonSqsAWSRegionApEast1      SourceAmazonSqsAWSRegion = "ap-east-1"
	SourceAmazonSqsAWSRegionApNortheast1 SourceAmazonSqsAWSRegion = "ap-northeast-1"
	SourceAmazonSqsAWSRegionApNortheast2 SourceAmazonSqsAWSRegion = "ap-northeast-2"
	SourceAmazonSqsAWSRegionApNortheast3 SourceAmazonSqsAWSRegion = "ap-northeast-3"
	SourceAmazonSqsAWSRegionApSouth1     SourceAmazonSqsAWSRegion = "ap-south-1"
	SourceAmazonSqsAWSRegionApSouth2     SourceAmazonSqsAWSRegion = "ap-south-2"
	SourceAmazonSqsAWSRegionApSoutheast1 SourceAmazonSqsAWSRegion = "ap-southeast-1"
	SourceAmazonSqsAWSRegionApSoutheast2 SourceAmazonSqsAWSRegion = "ap-southeast-2"
	SourceAmazonSqsAWSRegionApSoutheast3 SourceAmazonSqsAWSRegion = "ap-southeast-3"
	SourceAmazonSqsAWSRegionApSoutheast4 SourceAmazonSqsAWSRegion = "ap-southeast-4"
	SourceAmazonSqsAWSRegionCaCentral1   SourceAmazonSqsAWSRegion = "ca-central-1"
	SourceAmazonSqsAWSRegionCaWest1      SourceAmazonSqsAWSRegion = "ca-west-1"
	SourceAmazonSqsAWSRegionCnNorth1     SourceAmazonSqsAWSRegion = "cn-north-1"
	SourceAmazonSqsAWSRegionCnNorthwest1 SourceAmazonSqsAWSRegion = "cn-northwest-1"
	SourceAmazonSqsAWSRegionEuCentral1   SourceAmazonSqsAWSRegion = "eu-central-1"
	SourceAmazonSqsAWSRegionEuCentral2   SourceAmazonSqsAWSRegion = "eu-central-2"
	SourceAmazonSqsAWSRegionEuNorth1     SourceAmazonSqsAWSRegion = "eu-north-1"
	SourceAmazonSqsAWSRegionEuSouth1     SourceAmazonSqsAWSRegion = "eu-south-1"
	SourceAmazonSqsAWSRegionEuSouth2     SourceAmazonSqsAWSRegion = "eu-south-2"
	SourceAmazonSqsAWSRegionEuWest1      SourceAmazonSqsAWSRegion = "eu-west-1"
	SourceAmazonSqsAWSRegionEuWest2      SourceAmazonSqsAWSRegion = "eu-west-2"
	SourceAmazonSqsAWSRegionEuWest3      SourceAmazonSqsAWSRegion = "eu-west-3"
	SourceAmazonSqsAWSRegionIlCentral1   SourceAmazonSqsAWSRegion = "il-central-1"
	SourceAmazonSqsAWSRegionMeCentral1   SourceAmazonSqsAWSRegion = "me-central-1"
	SourceAmazonSqsAWSRegionMeSouth1     SourceAmazonSqsAWSRegion = "me-south-1"
	SourceAmazonSqsAWSRegionSaEast1      SourceAmazonSqsAWSRegion = "sa-east-1"
	SourceAmazonSqsAWSRegionUsEast1      SourceAmazonSqsAWSRegion = "us-east-1"
	SourceAmazonSqsAWSRegionUsEast2      SourceAmazonSqsAWSRegion = "us-east-2"
	SourceAmazonSqsAWSRegionUsGovEast1   SourceAmazonSqsAWSRegion = "us-gov-east-1"
	SourceAmazonSqsAWSRegionUsGovWest1   SourceAmazonSqsAWSRegion = "us-gov-west-1"
	SourceAmazonSqsAWSRegionUsWest1      SourceAmazonSqsAWSRegion = "us-west-1"
	SourceAmazonSqsAWSRegionUsWest2      SourceAmazonSqsAWSRegion = "us-west-2"
)

func (e SourceAmazonSqsAWSRegion) ToPointer() *SourceAmazonSqsAWSRegion {
	return &e
}
func (e *SourceAmazonSqsAWSRegion) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "af-south-1":
		fallthrough
	case "ap-east-1":
		fallthrough
	case "ap-northeast-1":
		fallthrough
	case "ap-northeast-2":
		fallthrough
	case "ap-northeast-3":
		fallthrough
	case "ap-south-1":
		fallthrough
	case "ap-south-2":
		fallthrough
	case "ap-southeast-1":
		fallthrough
	case "ap-southeast-2":
		fallthrough
	case "ap-southeast-3":
		fallthrough
	case "ap-southeast-4":
		fallthrough
	case "ca-central-1":
		fallthrough
	case "ca-west-1":
		fallthrough
	case "cn-north-1":
		fallthrough
	case "cn-northwest-1":
		fallthrough
	case "eu-central-1":
		fallthrough
	case "eu-central-2":
		fallthrough
	case "eu-north-1":
		fallthrough
	case "eu-south-1":
		fallthrough
	case "eu-south-2":
		fallthrough
	case "eu-west-1":
		fallthrough
	case "eu-west-2":
		fallthrough
	case "eu-west-3":
		fallthrough
	case "il-central-1":
		fallthrough
	case "me-central-1":
		fallthrough
	case "me-south-1":
		fallthrough
	case "sa-east-1":
		fallthrough
	case "us-east-1":
		fallthrough
	case "us-east-2":
		fallthrough
	case "us-gov-east-1":
		fallthrough
	case "us-gov-west-1":
		fallthrough
	case "us-west-1":
		fallthrough
	case "us-west-2":
		*e = SourceAmazonSqsAWSRegion(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceAmazonSqsAWSRegion: %v", v)
	}
}

// TheTargetedActionResourceForTheFetch - Note - Different targets have different attribute enum requirements, please refer actions sections in https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/Welcome.html
type TheTargetedActionResourceForTheFetch string

const (
	TheTargetedActionResourceForTheFetchGetQueueAttributes TheTargetedActionResourceForTheFetch = "GetQueueAttributes"
	TheTargetedActionResourceForTheFetchReceiveMessage     TheTargetedActionResourceForTheFetch = "ReceiveMessage"
)

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

type AmazonSqs string

const (
	AmazonSqsAmazonSqs AmazonSqs = "amazon-sqs"
)

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

type SourceAmazonSqs struct {
	// The Access Key ID of the AWS IAM Role to use for pulling messages
	AccessKey string `json:"access_key"`
	// Comma separated list of Mesage Attribute names to return
	AttributesToReturn *string `default:"All" json:"attributes_to_return"`
	// Max amount of messages to get in one batch (10 max)
	MaxBatchSize *int64 `default:"10" json:"max_batch_size"`
	// Max amount of time in seconds to wait for messages in a single poll (20 max)
	MaxWaitTime *int64 `default:"20" json:"max_wait_time"`
	// URL of the SQS Queue
	QueueURL string `json:"queue_url"`
	// AWS Region of the SQS Queue
	Region *SourceAmazonSqsAWSRegion `default:"us-east-1" json:"region"`
	// The Secret Key of the AWS IAM Role to use for pulling messages
	SecretKey string `json:"secret_key"`
	// Note - Different targets have different attribute enum requirements, please refer actions sections in https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/Welcome.html
	Target *TheTargetedActionResourceForTheFetch `default:"ReceiveMessage" json:"target"`
	// Modify the Visibility Timeout of the individual message from the Queue's default (seconds).
	VisibilityTimeout *int64    `default:"20" json:"visibility_timeout"`
	sourceType        AmazonSqs `const:"amazon-sqs" json:"sourceType"`
}

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

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

func (o *SourceAmazonSqs) GetAccessKey() string {
	if o == nil {
		return ""
	}
	return o.AccessKey
}

func (o *SourceAmazonSqs) GetAttributesToReturn() *string {
	if o == nil {
		return nil
	}
	return o.AttributesToReturn
}

func (o *SourceAmazonSqs) GetMaxBatchSize() *int64 {
	if o == nil {
		return nil
	}
	return o.MaxBatchSize
}

func (o *SourceAmazonSqs) GetMaxWaitTime() *int64 {
	if o == nil {
		return nil
	}
	return o.MaxWaitTime
}

func (o *SourceAmazonSqs) GetQueueURL() string {
	if o == nil {
		return ""
	}
	return o.QueueURL
}

func (o *SourceAmazonSqs) GetRegion() *SourceAmazonSqsAWSRegion {
	if o == nil {
		return nil
	}
	return o.Region
}

func (o *SourceAmazonSqs) GetSecretKey() string {
	if o == nil {
		return ""
	}
	return o.SecretKey
}

func (o *SourceAmazonSqs) GetTarget() *TheTargetedActionResourceForTheFetch {
	if o == nil {
		return nil
	}
	return o.Target
}

func (o *SourceAmazonSqs) GetVisibilityTimeout() *int64 {
	if o == nil {
		return nil
	}
	return o.VisibilityTimeout
}

func (o *SourceAmazonSqs) GetSourceType() AmazonSqs {
	return AmazonSqsAmazonSqs
}
