// 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 GoogleCredentials struct {
	// The Access Token for making authenticated requests. For detailed instructions on finding this value, refer to our <a href="https://docs.airbyte.com/integrations/sources/google-ads#setup-guide">documentation</a>.
	AccessToken *string `json:"access_token,omitempty"`
	// The Client ID of your Google Ads developer application. For detailed instructions on finding this value, refer to our <a href="https://docs.airbyte.com/integrations/sources/google-ads#setup-guide">documentation</a>.
	ClientID string `json:"client_id"`
	// The Client Secret of your Google Ads developer application. For detailed instructions on finding this value, refer to our <a href="https://docs.airbyte.com/integrations/sources/google-ads#setup-guide">documentation</a>.
	ClientSecret string `json:"client_secret"`
	// The Developer Token granted by Google to use their APIs. For detailed instructions on finding this value, refer to our <a href="https://docs.airbyte.com/integrations/sources/google-ads#setup-guide">documentation</a>.
	DeveloperToken string `json:"developer_token"`
	// The token used to obtain a new Access Token. For detailed instructions on finding this value, refer to our <a href="https://docs.airbyte.com/integrations/sources/google-ads#setup-guide">documentation</a>.
	RefreshToken string `json:"refresh_token"`
}

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

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

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

func (o *GoogleCredentials) GetDeveloperToken() string {
	if o == nil {
		return ""
	}
	return o.DeveloperToken
}

func (o *GoogleCredentials) GetRefreshToken() string {
	if o == nil {
		return ""
	}
	return o.RefreshToken
}

type CustomQueriesArray struct {
	// A custom defined GAQL query for building the report. Avoid including the segments.date field; wherever possible, Airbyte will automatically include it for incremental syncs. For more information, refer to <a href="https://developers.google.com/google-ads/api/fields/v11/overview_query_builder">Google's documentation</a>.
	Query string `json:"query"`
	// The table name in your destination database for the chosen query.
	TableName string `json:"table_name"`
}

func (o *CustomQueriesArray) GetQuery() string {
	if o == nil {
		return ""
	}
	return o.Query
}

func (o *CustomQueriesArray) GetTableName() string {
	if o == nil {
		return ""
	}
	return o.TableName
}

// CustomerStatus - An enumeration.
type CustomerStatus string

const (
	CustomerStatusUnknown   CustomerStatus = "UNKNOWN"
	CustomerStatusEnabled   CustomerStatus = "ENABLED"
	CustomerStatusCanceled  CustomerStatus = "CANCELED"
	CustomerStatusSuspended CustomerStatus = "SUSPENDED"
	CustomerStatusClosed    CustomerStatus = "CLOSED"
)

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

type GoogleAds string

const (
	GoogleAdsGoogleAds GoogleAds = "google-ads"
)

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

type SourceGoogleAds struct {
	// A conversion window is the number of days after an ad interaction (such as an ad click or video view) during which a conversion, such as a purchase, is recorded in Google Ads. For more information, see <a href="https://support.google.com/google-ads/answer/3123169?hl=en">Google's documentation</a>.
	ConversionWindowDays *int64               `default:"14" json:"conversion_window_days"`
	Credentials          GoogleCredentials    `json:"credentials"`
	CustomQueriesArray   []CustomQueriesArray `json:"custom_queries_array,omitempty"`
	// Comma-separated list of (client) customer IDs. Each customer ID must be specified as a 10-digit number without dashes. For detailed instructions on finding this value, refer to our <a href="https://docs.airbyte.com/integrations/sources/google-ads#setup-guide">documentation</a>.
	CustomerID *string `json:"customer_id,omitempty"`
	// A list of customer statuses to filter on. For detailed info about what each status mean refer to Google Ads <a href="https://developers.google.com/google-ads/api/reference/rpc/v15/CustomerStatusEnum.CustomerStatus">documentation</a>.
	CustomerStatusFilter []CustomerStatus `json:"customer_status_filter,omitempty"`
	// UTC date in the format YYYY-MM-DD. Any data after this date will not be replicated. (Default value of today is used if not set)
	EndDate *types.Date `json:"end_date,omitempty"`
	// UTC date in the format YYYY-MM-DD. Any data before this date will not be replicated. (Default value of two years ago is used if not set)
	StartDate  *types.Date `json:"start_date,omitempty"`
	sourceType GoogleAds   `const:"google-ads" json:"sourceType"`
}

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

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

func (o *SourceGoogleAds) GetConversionWindowDays() *int64 {
	if o == nil {
		return nil
	}
	return o.ConversionWindowDays
}

func (o *SourceGoogleAds) GetCredentials() GoogleCredentials {
	if o == nil {
		return GoogleCredentials{}
	}
	return o.Credentials
}

func (o *SourceGoogleAds) GetCustomQueriesArray() []CustomQueriesArray {
	if o == nil {
		return nil
	}
	return o.CustomQueriesArray
}

func (o *SourceGoogleAds) GetCustomerID() *string {
	if o == nil {
		return nil
	}
	return o.CustomerID
}

func (o *SourceGoogleAds) GetCustomerStatusFilter() []CustomerStatus {
	if o == nil {
		return nil
	}
	return o.CustomerStatusFilter
}

func (o *SourceGoogleAds) GetEndDate() *types.Date {
	if o == nil {
		return nil
	}
	return o.EndDate
}

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

func (o *SourceGoogleAds) GetSourceType() GoogleAds {
	return GoogleAdsGoogleAds
}
