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

package components

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

type MediaContainerWithArtworkType string

const (
	MediaContainerWithArtworkTypeImage MediaContainerWithArtworkType = "image"
)

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

type MediaContainerWithArtworkMetadata struct {
	// The title of the item
	Title *string                        `json:"title,omitempty"`
	Type  *MediaContainerWithArtworkType `json:"type,omitempty"`
	// The path to the artwork
	Key                  *string        `json:"key,omitempty"`
	AdditionalProperties map[string]any `additionalProperties:"true" json:"-"`
}

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

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

func (m *MediaContainerWithArtworkMetadata) GetTitle() *string {
	if m == nil {
		return nil
	}
	return m.Title
}

func (m *MediaContainerWithArtworkMetadata) GetType() *MediaContainerWithArtworkType {
	if m == nil {
		return nil
	}
	return m.Type
}

func (m *MediaContainerWithArtworkMetadata) GetKey() *string {
	if m == nil {
		return nil
	}
	return m.Key
}

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

// MediaContainerWithArtworkMediaContainer - `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 MediaContainerWithArtworkMediaContainer 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"`
	Metadata  []MediaContainerWithArtworkMetadata `json:"Metadata,omitempty"`
}

func (m *MediaContainerWithArtworkMediaContainer) GetIdentifier() *string {
	if m == nil {
		return nil
	}
	return m.Identifier
}

func (m *MediaContainerWithArtworkMediaContainer) GetOffset() *int64 {
	if m == nil {
		return nil
	}
	return m.Offset
}

func (m *MediaContainerWithArtworkMediaContainer) GetSize() *int64 {
	if m == nil {
		return nil
	}
	return m.Size
}

func (m *MediaContainerWithArtworkMediaContainer) GetTotalSize() *int64 {
	if m == nil {
		return nil
	}
	return m.TotalSize
}

func (m *MediaContainerWithArtworkMediaContainer) GetMetadata() []MediaContainerWithArtworkMetadata {
	if m == nil {
		return nil
	}
	return m.Metadata
}

type MediaContainerWithArtwork struct {
	MediaContainer *MediaContainerWithArtworkMediaContainer `json:"MediaContainer,omitempty"`
}

func (m *MediaContainerWithArtwork) GetMediaContainer() *MediaContainerWithArtworkMediaContainer {
	if m == nil {
		return nil
	}
	return m.MediaContainer
}
