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

type Chartmogul string

const (
	ChartmogulChartmogul Chartmogul = "chartmogul"
)

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

type SourceChartmogul struct {
	// Your Chartmogul API key. See <a href="https://help.chartmogul.com/hc/en-us/articles/4407796325906-Creating-and-Managing-API-keys#creating-an-api-key"> the docs </a> for info on how to obtain this.
	APIKey string `json:"api_key"`
	// UTC date and time in the format 2017-01-25T00:00:00Z. When feasible, any data before this date will not be replicated.
	StartDate  time.Time  `json:"start_date"`
	sourceType Chartmogul `const:"chartmogul" json:"sourceType"`
}

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

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

func (o *SourceChartmogul) GetAPIKey() string {
	if o == nil {
		return ""
	}
	return o.APIKey
}

func (o *SourceChartmogul) GetStartDate() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.StartDate
}

func (o *SourceChartmogul) GetSourceType() Chartmogul {
	return ChartmogulChartmogul
}
