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

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

const (
	SourceMissiveUpdateKindGroup        SourceMissiveUpdateKind = "group"
	SourceMissiveUpdateKindOrganization SourceMissiveUpdateKind = "organization"
)

func (e SourceMissiveUpdateKind) ToPointer() *SourceMissiveUpdateKind {
	return &e
}
func (e *SourceMissiveUpdateKind) 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 = SourceMissiveUpdateKind(v)
		return nil
	default:
		return fmt.Errorf("invalid value for SourceMissiveUpdateKind: %v", v)
	}
}

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

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

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

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

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

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

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