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

// ActionReportTime - Specifies the principle for conversion reporting.
type ActionReportTime string

const (
	ActionReportTimeConversion ActionReportTime = "conversion"
	ActionReportTimeImpression ActionReportTime = "impression"
)

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

// SwipeUpAttributionWindow - Attribution window for swipe ups.
type SwipeUpAttributionWindow string

const (
	SwipeUpAttributionWindowOneDay         SwipeUpAttributionWindow = "1_DAY"
	SwipeUpAttributionWindowSevenDay       SwipeUpAttributionWindow = "7_DAY"
	SwipeUpAttributionWindowTwentyEightDay SwipeUpAttributionWindow = "28_DAY"
)

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

// ViewAttributionWindow - Attribution window for views.
type ViewAttributionWindow string

const (
	ViewAttributionWindowOneHour   ViewAttributionWindow = "1_HOUR"
	ViewAttributionWindowThreeHour ViewAttributionWindow = "3_HOUR"
	ViewAttributionWindowSixHour   ViewAttributionWindow = "6_HOUR"
	ViewAttributionWindowOneDay    ViewAttributionWindow = "1_DAY"
	ViewAttributionWindowSevenDay  ViewAttributionWindow = "7_DAY"
)

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

type SnapchatMarketing string

const (
	SnapchatMarketingSnapchatMarketing SnapchatMarketing = "snapchat-marketing"
)

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

type SourceSnapchatMarketing struct {
	// Specifies the principle for conversion reporting.
	ActionReportTime *ActionReportTime `default:"conversion" json:"action_report_time"`
	// Ad Account IDs of the ad accounts to retrieve
	AdAccountIds []any `json:"ad_account_ids,omitempty"`
	// The Client ID of your Snapchat developer application.
	ClientID string `json:"client_id"`
	// The Client Secret of your Snapchat developer application.
	ClientSecret string `json:"client_secret"`
	// Date in the format 2017-01-25. Any data after this date will not be replicated.
	EndDate *types.Date `json:"end_date,omitempty"`
	// The IDs of the organizations to retrieve
	OrganizationIds []any `json:"organization_ids,omitempty"`
	// Refresh Token to renew the expired Access Token.
	RefreshToken string `json:"refresh_token"`
	// Date in the format 2022-01-01. Any data before this date will not be replicated.
	StartDate *types.Date `default:"2022-01-01" json:"start_date"`
	// Attribution window for swipe ups.
	SwipeUpAttributionWindow *SwipeUpAttributionWindow `default:"28_DAY" json:"swipe_up_attribution_window"`
	// Attribution window for views.
	ViewAttributionWindow *ViewAttributionWindow `default:"1_DAY" json:"view_attribution_window"`
	sourceType            SnapchatMarketing      `const:"snapchat-marketing" json:"sourceType"`
}

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

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

func (o *SourceSnapchatMarketing) GetActionReportTime() *ActionReportTime {
	if o == nil {
		return nil
	}
	return o.ActionReportTime
}

func (o *SourceSnapchatMarketing) GetAdAccountIds() []any {
	if o == nil {
		return nil
	}
	return o.AdAccountIds
}

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

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

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

func (o *SourceSnapchatMarketing) GetOrganizationIds() []any {
	if o == nil {
		return nil
	}
	return o.OrganizationIds
}

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

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

func (o *SourceSnapchatMarketing) GetSwipeUpAttributionWindow() *SwipeUpAttributionWindow {
	if o == nil {
		return nil
	}
	return o.SwipeUpAttributionWindow
}

func (o *SourceSnapchatMarketing) GetViewAttributionWindow() *ViewAttributionWindow {
	if o == nil {
		return nil
	}
	return o.ViewAttributionWindow
}

func (o *SourceSnapchatMarketing) GetSourceType() SnapchatMarketing {
	return SnapchatMarketingSnapchatMarketing
}
