// 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"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/types"
)

type FilterAppliedWhileFetchingRecordsBasedOnAttributeKeyAndAttributeValueWhichWillBeAppendedOnTheRequestBody struct {
	AttributeKey   *string `default:"EventName" json:"attribute_key"`
	AttributeValue *string `default:"ListInstanceAssociations" json:"attribute_value"`
}

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

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

func (o *FilterAppliedWhileFetchingRecordsBasedOnAttributeKeyAndAttributeValueWhichWillBeAppendedOnTheRequestBody) GetAttributeKey() *string {
	if o == nil {
		return nil
	}
	return o.AttributeKey
}

func (o *FilterAppliedWhileFetchingRecordsBasedOnAttributeKeyAndAttributeValueWhichWillBeAppendedOnTheRequestBody) GetAttributeValue() *string {
	if o == nil {
		return nil
	}
	return o.AttributeValue
}

type AwsCloudtrail string

const (
	AwsCloudtrailAwsCloudtrail AwsCloudtrail = "aws-cloudtrail"
)

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

type SourceAwsCloudtrail struct {
	// AWS CloudTrail Access Key ID. See the <a href="https://docs.airbyte.com/integrations/sources/aws-cloudtrail">docs</a> for more information on how to obtain this key.
	AwsKeyID string `json:"aws_key_id"`
	// The default AWS Region to use, for example, us-west-1 or us-west-2. When specifying a Region inline during client initialization, this property is named region_name.
	AwsRegionName *string `default:"us-east-1" json:"aws_region_name"`
	// AWS CloudTrail Access Key ID. See the <a href="https://docs.airbyte.com/integrations/sources/aws-cloudtrail">docs</a> for more information on how to obtain this key.
	AwsSecretKey           string                                                                                                    `json:"aws_secret_key"`
	LookupAttributesFilter *FilterAppliedWhileFetchingRecordsBasedOnAttributeKeyAndAttributeValueWhichWillBeAppendedOnTheRequestBody `json:"lookup_attributes_filter,omitempty"`
	// The date you would like to replicate data. Data in AWS CloudTrail is available for last 90 days only. Format: YYYY-MM-DD.
	StartDate  *types.Date   `json:"start_date,omitempty"`
	sourceType AwsCloudtrail `const:"aws-cloudtrail" json:"sourceType"`
}

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

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

func (o *SourceAwsCloudtrail) GetAwsKeyID() string {
	if o == nil {
		return ""
	}
	return o.AwsKeyID
}

func (o *SourceAwsCloudtrail) GetAwsRegionName() *string {
	if o == nil {
		return nil
	}
	return o.AwsRegionName
}

func (o *SourceAwsCloudtrail) GetAwsSecretKey() string {
	if o == nil {
		return ""
	}
	return o.AwsSecretKey
}

func (o *SourceAwsCloudtrail) GetLookupAttributesFilter() *FilterAppliedWhileFetchingRecordsBasedOnAttributeKeyAndAttributeValueWhichWillBeAppendedOnTheRequestBody {
	if o == nil {
		return nil
	}
	return o.LookupAttributesFilter
}

func (o *SourceAwsCloudtrail) GetStartDate() *types.Date {
	if o == nil {
		return nil
	}
	return o.StartDate
}

func (o *SourceAwsCloudtrail) GetSourceType() AwsCloudtrail {
	return AwsCloudtrailAwsCloudtrail
}
