// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package components

import (
	"encoding/json"
	"fmt"
	"github.com/LukeHagar/plexgo/internal/utils"
)

// DefaultAudioAccessibility - The audio accessibility mode (0 = Prefer non-accessibility audio, 1 = Prefer accessibility audio, 2 = Only show accessibility audio, 3 = Only show non-accessibility audio)
type DefaultAudioAccessibility int

const (
	DefaultAudioAccessibilityPreferNonAccessibility DefaultAudioAccessibility = 0
	DefaultAudioAccessibilityPreferAccessibility    DefaultAudioAccessibility = 1
	DefaultAudioAccessibilityOnlyAccessibility      DefaultAudioAccessibility = 2
	DefaultAudioAccessibilityOnlyNonAccessibility   DefaultAudioAccessibility = 3
)

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

// AutoSelectSubtitle - The auto-select subtitle mode (0 = Manually selected, 1 = Shown with foreign audio, 2 = Always enabled)
type AutoSelectSubtitle int

const (
	AutoSelectSubtitleManuallySelected      AutoSelectSubtitle = 0
	AutoSelectSubtitleShownWithForeignAudio AutoSelectSubtitle = 1
	AutoSelectSubtitleAlwaysEnabled         AutoSelectSubtitle = 2
)

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

// DefaultSubtitleAccessibility - The subtitles for the deaf or hard-of-hearing (SDH) searches mode (0 = Prefer non-SDH subtitles, 1 = Prefer SDH subtitles, 2 = Only show SDH subtitles, 3 = Only show non-SDH subtitles)
type DefaultSubtitleAccessibility int

const (
	DefaultSubtitleAccessibilityPreferNonSdh DefaultSubtitleAccessibility = 0
	DefaultSubtitleAccessibilityPreferSdh    DefaultSubtitleAccessibility = 1
	DefaultSubtitleAccessibilityOnlySdh      DefaultSubtitleAccessibility = 2
	DefaultSubtitleAccessibilityOnlyNonSdh   DefaultSubtitleAccessibility = 3
)

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

// DefaultSubtitleForced - The forced subtitles searches mode (0 = Prefer non-forced subtitles, 1 = Prefer forced subtitles, 2 = Only show forced subtitles, 3 = Only show non-forced subtitles)
type DefaultSubtitleForced int

const (
	DefaultSubtitleForcedPreferNonForced DefaultSubtitleForced = 0
	DefaultSubtitleForcedPreferForced    DefaultSubtitleForced = 1
	DefaultSubtitleForcedOnlyForced      DefaultSubtitleForced = 2
	DefaultSubtitleForcedOnlyNonForced   DefaultSubtitleForced = 3
)

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

// WatchedIndicator - Whether or not media watched indicators are enabled (little orange dot on media)
type WatchedIndicator int

const (
	WatchedIndicatorNone             WatchedIndicator = 0
	WatchedIndicatorMoviesAndTvShows WatchedIndicator = 1
	WatchedIndicatorMovies           WatchedIndicator = 2
	WatchedIndicatorTvShows          WatchedIndicator = 3
)

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

// MediaReviewsVisibility - Whether or not the account has media reviews visibility enabled
type MediaReviewsVisibility int

const (
	MediaReviewsVisibilityNoOne               MediaReviewsVisibility = 0
	MediaReviewsVisibilityCriticsOnly         MediaReviewsVisibility = 1
	MediaReviewsVisibilityPlexUsersOnly       MediaReviewsVisibility = 2
	MediaReviewsVisibilityPlexUsersAndCritics MediaReviewsVisibility = 3
)

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

type UserProfile struct {
	// If the account has automatically select audio and subtitle tracks enabled
	AutoSelectAudio *bool `default:"true" json:"autoSelectAudio"`
	// The preferred audio language for the account
	DefaultAudioLanguage      *string                    `json:"defaultAudioLanguage"`
	DefaultAudioAccessibility *DefaultAudioAccessibility `default:"0" json:"defaultAudioAccessibility"`
	// The preferred audio languages for the account
	DefaultAudioLanguages []string `json:"defaultAudioLanguages,omitempty"`
	// The preferred subtitle language for the account
	DefaultSubtitleLanguage *string `json:"defaultSubtitleLanguage"`
	// The preferred subtitle languages for the account
	DefaultSubtitleLanguages     []string                      `json:"defaultSubtitleLanguages,omitempty"`
	AutoSelectSubtitle           *AutoSelectSubtitle           `default:"0" json:"autoSelectSubtitle"`
	DefaultSubtitleAccessibility *DefaultSubtitleAccessibility `default:"0" json:"defaultSubtitleAccessibility"`
	DefaultSubtitleForced        *DefaultSubtitleForced        `default:"0" json:"defaultSubtitleForced"`
	WatchedIndicator             *WatchedIndicator             `default:"0" json:"watchedIndicator"`
	MediaReviewsVisibility       *MediaReviewsVisibility       `default:"0" json:"mediaReviewsVisibility"`
	// The languages for media reviews visibility
	MediaReviewsLanguages []string `json:"mediaReviewsLanguages,omitempty"`
}

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

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

func (u *UserProfile) GetAutoSelectAudio() *bool {
	if u == nil {
		return nil
	}
	return u.AutoSelectAudio
}

func (u *UserProfile) GetDefaultAudioLanguage() *string {
	if u == nil {
		return nil
	}
	return u.DefaultAudioLanguage
}

func (u *UserProfile) GetDefaultAudioAccessibility() *DefaultAudioAccessibility {
	if u == nil {
		return nil
	}
	return u.DefaultAudioAccessibility
}

func (u *UserProfile) GetDefaultAudioLanguages() []string {
	if u == nil {
		return nil
	}
	return u.DefaultAudioLanguages
}

func (u *UserProfile) GetDefaultSubtitleLanguage() *string {
	if u == nil {
		return nil
	}
	return u.DefaultSubtitleLanguage
}

func (u *UserProfile) GetDefaultSubtitleLanguages() []string {
	if u == nil {
		return nil
	}
	return u.DefaultSubtitleLanguages
}

func (u *UserProfile) GetAutoSelectSubtitle() *AutoSelectSubtitle {
	if u == nil {
		return nil
	}
	return u.AutoSelectSubtitle
}

func (u *UserProfile) GetDefaultSubtitleAccessibility() *DefaultSubtitleAccessibility {
	if u == nil {
		return nil
	}
	return u.DefaultSubtitleAccessibility
}

func (u *UserProfile) GetDefaultSubtitleForced() *DefaultSubtitleForced {
	if u == nil {
		return nil
	}
	return u.DefaultSubtitleForced
}

func (u *UserProfile) GetWatchedIndicator() *WatchedIndicator {
	if u == nil {
		return nil
	}
	return u.WatchedIndicator
}

func (u *UserProfile) GetMediaReviewsVisibility() *MediaReviewsVisibility {
	if u == nil {
		return nil
	}
	return u.MediaReviewsVisibility
}

func (u *UserProfile) GetMediaReviewsLanguages() []string {
	if u == nil {
		return nil
	}
	return u.MediaReviewsLanguages
}
