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

package components

import (
	"encoding/json"
	"fmt"
)

// MediaTypeString - The type of media content in the Plex library. This can represent videos, music, or photos.
type MediaTypeString string

const (
	MediaTypeStringMovie      MediaTypeString = "movie"
	MediaTypeStringTvShow     MediaTypeString = "show"
	MediaTypeStringSeason     MediaTypeString = "season"
	MediaTypeStringEpisode    MediaTypeString = "episode"
	MediaTypeStringArtist     MediaTypeString = "artist"
	MediaTypeStringAlbum      MediaTypeString = "album"
	MediaTypeStringTrack      MediaTypeString = "track"
	MediaTypeStringPhotoAlbum MediaTypeString = "photoalbum"
	MediaTypeStringPhoto      MediaTypeString = "photo"
	MediaTypeStringCollection MediaTypeString = "collection"
)

func (e MediaTypeString) ToPointer() *MediaTypeString {
	return &e
}
func (e *MediaTypeString) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "movie":
		fallthrough
	case "show":
		fallthrough
	case "season":
		fallthrough
	case "episode":
		fallthrough
	case "artist":
		fallthrough
	case "album":
		fallthrough
	case "track":
		fallthrough
	case "photoalbum":
		fallthrough
	case "photo":
		fallthrough
	case "collection":
		*e = MediaTypeString(v)
		return nil
	default:
		return fmt.Errorf("invalid value for MediaTypeString: %v", v)
	}
}
