// 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 Aviationstack string

const (
	AviationstackAviationstack Aviationstack = "aviationstack"
)

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

type SourceAviationstack struct {
	// Your unique API key for authenticating with the Aviation API. You can find it in your Aviation account dashboard at https://aviationstack.com/dashboard
	AccessKey  string        `json:"access_key"`
	StartDate  time.Time     `json:"start_date"`
	sourceType Aviationstack `const:"aviationstack" json:"sourceType"`
}

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

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

func (o *SourceAviationstack) GetAccessKey() string {
	if o == nil {
		return ""
	}
	return o.AccessKey
}

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

func (o *SourceAviationstack) GetSourceType() Aviationstack {
	return AviationstackAviationstack
}
