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

package components

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

type PostResponses200Type string

const (
	PostResponses200TypeIntro      PostResponses200Type = "intro"
	PostResponses200TypeCommercial PostResponses200Type = "commercial"
	PostResponses200TypeBookmark   PostResponses200Type = "bookmark"
	PostResponses200TypeResume     PostResponses200Type = "resume"
	PostResponses200TypeCredit     PostResponses200Type = "credit"
)

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

// PostResponses200MediaContainer - `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.
// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)
// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.
type PostResponses200MediaContainer struct {
	Identifier *string `json:"identifier,omitempty"`
	// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.
	//
	Offset *int64 `json:"offset,omitempty"`
	Size   *int64 `json:"size,omitempty"`
	// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.
	//
	TotalSize            *int64                `json:"totalSize,omitempty"`
	Color                *string               `json:"color,omitempty"`
	EndTimeOffset        *int64                `json:"endTimeOffset,omitempty"`
	ID                   *int64                `json:"id,omitempty"`
	StartTimeOffset      *int64                `json:"startTimeOffset,omitempty"`
	Title                *string               `json:"title,omitempty"`
	Type                 *PostResponses200Type `json:"type,omitempty"`
	AdditionalProperties map[string]any        `additionalProperties:"true" json:"-"`
}

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

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

func (p *PostResponses200MediaContainer) GetIdentifier() *string {
	if p == nil {
		return nil
	}
	return p.Identifier
}

func (p *PostResponses200MediaContainer) GetOffset() *int64 {
	if p == nil {
		return nil
	}
	return p.Offset
}

func (p *PostResponses200MediaContainer) GetSize() *int64 {
	if p == nil {
		return nil
	}
	return p.Size
}

func (p *PostResponses200MediaContainer) GetTotalSize() *int64 {
	if p == nil {
		return nil
	}
	return p.TotalSize
}

func (p *PostResponses200MediaContainer) GetColor() *string {
	if p == nil {
		return nil
	}
	return p.Color
}

func (p *PostResponses200MediaContainer) GetEndTimeOffset() *int64 {
	if p == nil {
		return nil
	}
	return p.EndTimeOffset
}

func (p *PostResponses200MediaContainer) GetID() *int64 {
	if p == nil {
		return nil
	}
	return p.ID
}

func (p *PostResponses200MediaContainer) GetStartTimeOffset() *int64 {
	if p == nil {
		return nil
	}
	return p.StartTimeOffset
}

func (p *PostResponses200MediaContainer) GetTitle() *string {
	if p == nil {
		return nil
	}
	return p.Title
}

func (p *PostResponses200MediaContainer) GetType() *PostResponses200Type {
	if p == nil {
		return nil
	}
	return p.Type
}

func (p *PostResponses200MediaContainer) GetAdditionalProperties() map[string]any {
	if p == nil {
		return nil
	}
	return p.AdditionalProperties
}

// PostResponses200 - OK
type PostResponses200 struct {
	MediaContainer *PostResponses200MediaContainer `json:"MediaContainer,omitempty"`
}

func (p *PostResponses200) GetMediaContainer() *PostResponses200MediaContainer {
	if p == nil {
		return nil
	}
	return p.MediaContainer
}
