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

package components

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

// MailingListStatus - Your current mailing list status
type MailingListStatus string

const (
	MailingListStatusActive       MailingListStatus = "active"
	MailingListStatusUnsubscribed MailingListStatus = "unsubscribed"
	MailingListStatusRemoved      MailingListStatus = "removed"
)

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

type UserPlexAccountStatus string

const (
	UserPlexAccountStatusOnline  UserPlexAccountStatus = "online"
	UserPlexAccountStatusOffline UserPlexAccountStatus = "offline"
)

func (e UserPlexAccountStatus) ToPointer() *UserPlexAccountStatus {
	return &e
}

// IsExact returns true if the value matches a known enum value, false otherwise.
func (e *UserPlexAccountStatus) IsExact() bool {
	if e != nil {
		switch *e {
		case "online", "offline":
			return true
		}
	}
	return false
}

type Services struct {
	Identifier string                `json:"identifier"`
	Endpoint   string                `json:"endpoint"`
	Token      *string               `json:"token"`
	Secret     *string               `json:"secret"`
	Status     UserPlexAccountStatus `json:"status"`
}

func (s *Services) GetIdentifier() string {
	if s == nil {
		return ""
	}
	return s.Identifier
}

func (s *Services) GetEndpoint() string {
	if s == nil {
		return ""
	}
	return s.Endpoint
}

func (s *Services) GetToken() *string {
	if s == nil {
		return nil
	}
	return s.Token
}

func (s *Services) GetSecret() *string {
	if s == nil {
		return nil
	}
	return s.Secret
}

func (s *Services) GetStatus() UserPlexAccountStatus {
	if s == nil {
		return UserPlexAccountStatus("")
	}
	return s.Status
}

// UserPlexAccountSubscriptionStatus - String representation of subscriptionActive
type UserPlexAccountSubscriptionStatus string

const (
	UserPlexAccountSubscriptionStatusInactive UserPlexAccountSubscriptionStatus = "Inactive"
	UserPlexAccountSubscriptionStatusActive   UserPlexAccountSubscriptionStatus = "Active"
)

func (e UserPlexAccountSubscriptionStatus) ToPointer() *UserPlexAccountSubscriptionStatus {
	return &e
}

// IsExact returns true if the value matches a known enum value, false otherwise.
func (e *UserPlexAccountSubscriptionStatus) IsExact() bool {
	if e != nil {
		switch *e {
		case "Inactive", "Active":
			return true
		}
	}
	return false
}

// Subscription - If the account's Plex Pass subscription is active
type Subscription struct {
	// List of features allowed on your Plex Pass subscription
	Features []string `json:"features,omitempty"`
	// If the account's Plex Pass subscription is active
	Active *bool `json:"active,omitempty"`
	// Date the account subscribed to Plex Pass
	SubscribedAt *string `json:"subscribedAt,omitempty"`
	// String representation of subscriptionActive
	Status *UserPlexAccountSubscriptionStatus `json:"status,omitempty"`
	// Payment service used for your Plex Pass subscription
	PaymentService *string `json:"paymentService,omitempty"`
	// Name of Plex Pass subscription plan
	Plan *string `json:"plan,omitempty"`
}

func (s *Subscription) GetFeatures() []string {
	if s == nil {
		return nil
	}
	return s.Features
}

func (s *Subscription) GetActive() *bool {
	if s == nil {
		return nil
	}
	return s.Active
}

func (s *Subscription) GetSubscribedAt() *string {
	if s == nil {
		return nil
	}
	return s.SubscribedAt
}

func (s *Subscription) GetStatus() *UserPlexAccountSubscriptionStatus {
	if s == nil {
		return nil
	}
	return s.Status
}

func (s *Subscription) GetPaymentService() *string {
	if s == nil {
		return nil
	}
	return s.PaymentService
}

func (s *Subscription) GetPlan() *string {
	if s == nil {
		return nil
	}
	return s.Plan
}

// UserPlexAccountSubscriptionsStatus - String representation of subscriptionActive
type UserPlexAccountSubscriptionsStatus string

const (
	UserPlexAccountSubscriptionsStatusInactive UserPlexAccountSubscriptionsStatus = "Inactive"
	UserPlexAccountSubscriptionsStatusActive   UserPlexAccountSubscriptionsStatus = "Active"
)

func (e UserPlexAccountSubscriptionsStatus) ToPointer() *UserPlexAccountSubscriptionsStatus {
	return &e
}

// IsExact returns true if the value matches a known enum value, false otherwise.
func (e *UserPlexAccountSubscriptionsStatus) IsExact() bool {
	if e != nil {
		switch *e {
		case "Inactive", "Active":
			return true
		}
	}
	return false
}

type UserPlexAccountSubscription struct {
	// List of features allowed on your Plex Pass subscription
	Features []string `json:"features,omitempty"`
	// If the account's Plex Pass subscription is active
	Active *bool `json:"active,omitempty"`
	// Date the account subscribed to Plex Pass
	SubscribedAt *string `json:"subscribedAt,omitempty"`
	// String representation of subscriptionActive
	Status *UserPlexAccountSubscriptionsStatus `json:"status,omitempty"`
	// Payment service used for your Plex Pass subscription
	PaymentService *string `json:"paymentService,omitempty"`
	// Name of Plex Pass subscription plan
	Plan *string `json:"plan,omitempty"`
}

func (u *UserPlexAccountSubscription) GetFeatures() []string {
	if u == nil {
		return nil
	}
	return u.Features
}

func (u *UserPlexAccountSubscription) GetActive() *bool {
	if u == nil {
		return nil
	}
	return u.Active
}

func (u *UserPlexAccountSubscription) GetSubscribedAt() *string {
	if u == nil {
		return nil
	}
	return u.SubscribedAt
}

func (u *UserPlexAccountSubscription) GetStatus() *UserPlexAccountSubscriptionsStatus {
	if u == nil {
		return nil
	}
	return u.Status
}

func (u *UserPlexAccountSubscription) GetPaymentService() *string {
	if u == nil {
		return nil
	}
	return u.PaymentService
}

func (u *UserPlexAccountSubscription) GetPlan() *string {
	if u == nil {
		return nil
	}
	return u.Plan
}

type UserPlexAccount struct {
	// Unknown
	AdsConsent           *bool  `json:"adsConsent,omitempty"`
	AdsConsentReminderAt *int64 `json:"adsConsentReminderAt,omitempty"`
	AdsConsentSetAt      *int64 `json:"adsConsentSetAt,omitempty"`
	// Unknown
	Anonymous *bool `default:"false" json:"anonymous"`
	// The account token
	AuthToken string `json:"authToken"`
	// If the two-factor authentication backup codes have been created
	BackupCodesCreated *bool `default:"false" json:"backupCodesCreated"`
	// If the account has been confirmed
	Confirmed *bool `default:"false" json:"confirmed"`
	// The account country
	Country *string `json:"country,omitempty"`
	// The account email address
	Email string `json:"email"`
	// If login with email only is enabled
	EmailOnlyAuth *bool `default:"false" json:"emailOnlyAuth"`
	// If experimental features are enabled
	ExperimentalFeatures *bool `default:"false" json:"experimentalFeatures"`
	// Your account full name
	FriendlyName string `json:"friendlyName"`
	// List of devices your allowed to use with this account
	Entitlements []string `json:"entitlements,omitempty"`
	// If the account is a Plex Home guest user
	Guest *bool `default:"false" json:"guest"`
	// If the account has a password
	HasPassword *bool `default:"true" json:"hasPassword"`
	// If the account is a Plex Home user
	Home *bool `default:"false" json:"home"`
	// If the account is the Plex Home admin
	HomeAdmin *bool `default:"false" json:"homeAdmin"`
	// The number of accounts in the Plex Home
	HomeSize *int `json:"homeSize,omitempty"`
	// The Plex account ID
	ID int `json:"id"`
	// Unix epoch datetime in seconds
	JoinedAt int64 `json:"joinedAt"`
	// The account locale
	Locale *string `json:"locale,omitempty"`
	// If you are subscribed to the Plex newsletter
	MailingListActive *bool `default:"false" json:"mailingListActive"`
	// Your current mailing list status
	MailingListStatus *MailingListStatus `json:"mailingListStatus,omitempty"`
	// The maximum number of accounts allowed in the Plex Home
	MaxHomeSize *int `json:"maxHomeSize,omitempty"`
	// [Might be removed] The hashed Plex Home PIN
	//
	// Deprecated: This will be removed in a future release, please migrate away from it as soon as possible.
	Pin     *string      `json:"pin,omitempty"`
	Profile *UserProfile `json:"profile,omitempty"`
	// If the account has a Plex Home PIN enabled
	Protected *bool `default:"false" json:"protected"`
	// Unix epoch datetime in seconds
	RememberExpiresAt *int64 `json:"rememberExpiresAt,omitempty"`
	// If the account is a Plex Home managed user
	Restricted *bool `default:"false" json:"restricted"`
	// [Might be removed] List of account roles. Plexpass membership listed here
	Roles []string `json:"roles,omitempty"`
	// Unknown
	ScrobbleTypes *string    `json:"scrobbleTypes,omitempty"`
	Services      []Services `json:"services,omitempty"`
	// If the account's Plex Pass subscription is active
	Subscription *Subscription `json:"subscription,omitempty"`
	// Description of the Plex Pass subscription
	SubscriptionDescription *string                       `json:"subscriptionDescription,omitempty"`
	Subscriptions           []UserPlexAccountSubscription `json:"subscriptions,omitempty"`
	// URL of the account thumbnail
	Thumb *string `json:"thumb,omitempty"`
	// The title of the account (username or friendly name)
	Title string `json:"title"`
	// If two-factor authentication is enabled
	TwoFactorEnabled *bool `default:"false" json:"twoFactorEnabled"`
	// The account username
	Username string `json:"username"`
	// The account UUID
	UUID               string  `json:"uuid"`
	AttributionPartner *string `json:"attributionPartner,omitempty"`
}

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

func (u *UserPlexAccount) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &u, "", false, []string{"authToken", "email", "friendlyName", "id", "joinedAt", "title", "username", "uuid"}); err != nil {
		return err
	}
	return nil
}

func (u *UserPlexAccount) GetAdsConsent() *bool {
	if u == nil {
		return nil
	}
	return u.AdsConsent
}

func (u *UserPlexAccount) GetAdsConsentReminderAt() *int64 {
	if u == nil {
		return nil
	}
	return u.AdsConsentReminderAt
}

func (u *UserPlexAccount) GetAdsConsentSetAt() *int64 {
	if u == nil {
		return nil
	}
	return u.AdsConsentSetAt
}

func (u *UserPlexAccount) GetAnonymous() *bool {
	if u == nil {
		return nil
	}
	return u.Anonymous
}

func (u *UserPlexAccount) GetAuthToken() string {
	if u == nil {
		return ""
	}
	return u.AuthToken
}

func (u *UserPlexAccount) GetBackupCodesCreated() *bool {
	if u == nil {
		return nil
	}
	return u.BackupCodesCreated
}

func (u *UserPlexAccount) GetConfirmed() *bool {
	if u == nil {
		return nil
	}
	return u.Confirmed
}

func (u *UserPlexAccount) GetCountry() *string {
	if u == nil {
		return nil
	}
	return u.Country
}

func (u *UserPlexAccount) GetEmail() string {
	if u == nil {
		return ""
	}
	return u.Email
}

func (u *UserPlexAccount) GetEmailOnlyAuth() *bool {
	if u == nil {
		return nil
	}
	return u.EmailOnlyAuth
}

func (u *UserPlexAccount) GetExperimentalFeatures() *bool {
	if u == nil {
		return nil
	}
	return u.ExperimentalFeatures
}

func (u *UserPlexAccount) GetFriendlyName() string {
	if u == nil {
		return ""
	}
	return u.FriendlyName
}

func (u *UserPlexAccount) GetEntitlements() []string {
	if u == nil {
		return nil
	}
	return u.Entitlements
}

func (u *UserPlexAccount) GetGuest() *bool {
	if u == nil {
		return nil
	}
	return u.Guest
}

func (u *UserPlexAccount) GetHasPassword() *bool {
	if u == nil {
		return nil
	}
	return u.HasPassword
}

func (u *UserPlexAccount) GetHome() *bool {
	if u == nil {
		return nil
	}
	return u.Home
}

func (u *UserPlexAccount) GetHomeAdmin() *bool {
	if u == nil {
		return nil
	}
	return u.HomeAdmin
}

func (u *UserPlexAccount) GetHomeSize() *int {
	if u == nil {
		return nil
	}
	return u.HomeSize
}

func (u *UserPlexAccount) GetID() int {
	if u == nil {
		return 0
	}
	return u.ID
}

func (u *UserPlexAccount) GetJoinedAt() int64 {
	if u == nil {
		return 0
	}
	return u.JoinedAt
}

func (u *UserPlexAccount) GetLocale() *string {
	if u == nil {
		return nil
	}
	return u.Locale
}

func (u *UserPlexAccount) GetMailingListActive() *bool {
	if u == nil {
		return nil
	}
	return u.MailingListActive
}

func (u *UserPlexAccount) GetMailingListStatus() *MailingListStatus {
	if u == nil {
		return nil
	}
	return u.MailingListStatus
}

func (u *UserPlexAccount) GetMaxHomeSize() *int {
	if u == nil {
		return nil
	}
	return u.MaxHomeSize
}

func (u *UserPlexAccount) GetPin() *string {
	if u == nil {
		return nil
	}
	return u.Pin
}

func (u *UserPlexAccount) GetProfile() *UserProfile {
	if u == nil {
		return nil
	}
	return u.Profile
}

func (u *UserPlexAccount) GetProtected() *bool {
	if u == nil {
		return nil
	}
	return u.Protected
}

func (u *UserPlexAccount) GetRememberExpiresAt() *int64 {
	if u == nil {
		return nil
	}
	return u.RememberExpiresAt
}

func (u *UserPlexAccount) GetRestricted() *bool {
	if u == nil {
		return nil
	}
	return u.Restricted
}

func (u *UserPlexAccount) GetRoles() []string {
	if u == nil {
		return nil
	}
	return u.Roles
}

func (u *UserPlexAccount) GetScrobbleTypes() *string {
	if u == nil {
		return nil
	}
	return u.ScrobbleTypes
}

func (u *UserPlexAccount) GetServices() []Services {
	if u == nil {
		return nil
	}
	return u.Services
}

func (u *UserPlexAccount) GetSubscription() *Subscription {
	if u == nil {
		return nil
	}
	return u.Subscription
}

func (u *UserPlexAccount) GetSubscriptionDescription() *string {
	if u == nil {
		return nil
	}
	return u.SubscriptionDescription
}

func (u *UserPlexAccount) GetSubscriptions() []UserPlexAccountSubscription {
	if u == nil {
		return nil
	}
	return u.Subscriptions
}

func (u *UserPlexAccount) GetThumb() *string {
	if u == nil {
		return nil
	}
	return u.Thumb
}

func (u *UserPlexAccount) GetTitle() string {
	if u == nil {
		return ""
	}
	return u.Title
}

func (u *UserPlexAccount) GetTwoFactorEnabled() *bool {
	if u == nil {
		return nil
	}
	return u.TwoFactorEnabled
}

func (u *UserPlexAccount) GetUsername() string {
	if u == nil {
		return ""
	}
	return u.Username
}

func (u *UserPlexAccount) GetUUID() string {
	if u == nil {
		return ""
	}
	return u.UUID
}

func (u *UserPlexAccount) GetAttributionPartner() *string {
	if u == nil {
		return nil
	}
	return u.AttributionPartner
}
