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

// ContentType - Select the content type of the items to retrieve.
type ContentType string

const (
	ContentTypeArticle ContentType = "article"
	ContentTypeVideo   ContentType = "video"
	ContentTypeImage   ContentType = "image"
)

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

// DetailType - Select the granularity of the information about each item.
type DetailType string

const (
	DetailTypeSimple   DetailType = "simple"
	DetailTypeComplete DetailType = "complete"
)

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

// SourcePocketSortBy - Sort retrieved items by the given criteria.
type SourcePocketSortBy string

const (
	SourcePocketSortByNewest SourcePocketSortBy = "newest"
	SourcePocketSortByOldest SourcePocketSortBy = "oldest"
	SourcePocketSortByTitle  SourcePocketSortBy = "title"
	SourcePocketSortBySite   SourcePocketSortBy = "site"
)

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

// State - Select the state of the items to retrieve.
type State string

const (
	StateUnread  State = "unread"
	StateArchive State = "archive"
	StateAll     State = "all"
)

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

type Pocket string

const (
	PocketPocket Pocket = "pocket"
)

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

type SourcePocket struct {
	// The user's Pocket access token.
	AccessToken string `json:"access_token"`
	// Your application's Consumer Key.
	ConsumerKey string `json:"consumer_key"`
	// Select the content type of the items to retrieve.
	ContentType *ContentType `json:"content_type,omitempty"`
	// Select the granularity of the information about each item.
	DetailType *DetailType `json:"detail_type,omitempty"`
	// Only return items from a particular `domain`.
	Domain *string `json:"domain,omitempty"`
	// Retrieve only favorited items.
	Favorite *bool `default:"false" json:"favorite"`
	// Only return items whose title or url contain the `search` string.
	Search *string `json:"search,omitempty"`
	// Only return items modified since the given timestamp.
	Since *string `json:"since,omitempty"`
	// Sort retrieved items by the given criteria.
	Sort *SourcePocketSortBy `json:"sort,omitempty"`
	// Select the state of the items to retrieve.
	State *State `json:"state,omitempty"`
	// Return only items tagged with this tag name. Use _untagged_ for retrieving only untagged items.
	Tag        *string `json:"tag,omitempty"`
	sourceType Pocket  `const:"pocket" json:"sourceType"`
}

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

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

func (o *SourcePocket) GetAccessToken() string {
	if o == nil {
		return ""
	}
	return o.AccessToken
}

func (o *SourcePocket) GetConsumerKey() string {
	if o == nil {
		return ""
	}
	return o.ConsumerKey
}

func (o *SourcePocket) GetContentType() *ContentType {
	if o == nil {
		return nil
	}
	return o.ContentType
}

func (o *SourcePocket) GetDetailType() *DetailType {
	if o == nil {
		return nil
	}
	return o.DetailType
}

func (o *SourcePocket) GetDomain() *string {
	if o == nil {
		return nil
	}
	return o.Domain
}

func (o *SourcePocket) GetFavorite() *bool {
	if o == nil {
		return nil
	}
	return o.Favorite
}

func (o *SourcePocket) GetSearch() *string {
	if o == nil {
		return nil
	}
	return o.Search
}

func (o *SourcePocket) GetSince() *string {
	if o == nil {
		return nil
	}
	return o.Since
}

func (o *SourcePocket) GetSort() *SourcePocketSortBy {
	if o == nil {
		return nil
	}
	return o.Sort
}

func (o *SourcePocket) GetState() *State {
	if o == nil {
		return nil
	}
	return o.State
}

func (o *SourcePocket) GetTag() *string {
	if o == nil {
		return nil
	}
	return o.Tag
}

func (o *SourcePocket) GetSourceType() Pocket {
	return PocketPocket
}
