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

// Kind parameter for `contact_groups` stream
type Kind string

const (
	KindGroup        Kind = "group"
	KindOrganization Kind = "organization"
)

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

type Missive string

const (
	MissiveMissive Missive = "missive"
)

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

type SourceMissive struct {
	APIKey string `json:"api_key"`
	// Kind parameter for `contact_groups` stream
	Kind *Kind `default:"group" json:"kind"`
	// Max records per page limit
	Limit      *string   `default:"50" json:"limit"`
	StartDate  time.Time `json:"start_date"`
	sourceType Missive   `const:"missive" json:"sourceType"`
}

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

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

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

func (o *SourceMissive) GetKind() *Kind {
	if o == nil {
		return nil
	}
	return o.Kind
}

func (o *SourceMissive) GetLimit() *string {
	if o == nil {
		return nil
	}
	return o.Limit
}

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

func (o *SourceMissive) GetSourceType() Missive {
	return MissiveMissive
}
