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

type Appsflyer string

const (
	AppsflyerAppsflyer Appsflyer = "appsflyer"
)

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

type SourceAppsflyer struct {
	// Pull API token for authentication. If you change the account admin, the token changes, and you must update scripts with the new token. <a href="https://support.appsflyer.com/hc/en-us/articles/360004562377">Get the API token in the Dashboard</a>.
	APIToken string `json:"api_token"`
	// App identifier as found in AppsFlyer.
	AppID string `json:"app_id"`
	// The default value to use if no bookmark exists for an endpoint. Raw Reports historical lookback is limited to 90 days.
	StartDate string `json:"start_date"`
	// Time zone in which date times are stored. The project timezone may be found in the App settings in the AppsFlyer console.
	Timezone   *string   `default:"UTC" json:"timezone"`
	sourceType Appsflyer `const:"appsflyer" json:"sourceType"`
}

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

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

func (o *SourceAppsflyer) GetAPIToken() string {
	if o == nil {
		return ""
	}
	return o.APIToken
}

func (o *SourceAppsflyer) GetAppID() string {
	if o == nil {
		return ""
	}
	return o.AppID
}

func (o *SourceAppsflyer) GetStartDate() string {
	if o == nil {
		return ""
	}
	return o.StartDate
}

func (o *SourceAppsflyer) GetTimezone() *string {
	if o == nil {
		return nil
	}
	return o.Timezone
}

func (o *SourceAppsflyer) GetSourceType() Appsflyer {
	return AppsflyerAppsflyer
}
