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

package operations

import (
	"encoding/json"
	"fmt"
	"github.com/LukeHagar/plexgo/internal/utils"
	"github.com/LukeHagar/plexgo/models/components"
	"io"
	"net/http"
)

type TranscodeImageGlobals struct {
	// Indicates the client accepts the indicated media types
	Accepts *components.Accepts `default:"application/xml" header:"style=simple,explode=false,name=accepts"`
	// An opaque identifier unique to the client
	ClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
	// The name of the client product
	Product *string `header:"style=simple,explode=false,name=X-Plex-Product"`
	// The version of the client application
	Version *string `header:"style=simple,explode=false,name=X-Plex-Version"`
	// The platform of the client
	Platform *string `header:"style=simple,explode=false,name=X-Plex-Platform"`
	// The version of the platform
	PlatformVersion *string `header:"style=simple,explode=false,name=X-Plex-Platform-Version"`
	// A relatively friendly name for the client device
	Device *string `header:"style=simple,explode=false,name=X-Plex-Device"`
	// A potentially less friendly identifier for the device model
	Model *string `header:"style=simple,explode=false,name=X-Plex-Model"`
	// The device vendor
	DeviceVendor *string `header:"style=simple,explode=false,name=X-Plex-Device-Vendor"`
	// A friendly name for the client
	DeviceName *string `header:"style=simple,explode=false,name=X-Plex-Device-Name"`
	// The marketplace on which the client application is distributed
	Marketplace *string `header:"style=simple,explode=false,name=X-Plex-Marketplace"`
}

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

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

func (t *TranscodeImageGlobals) GetAccepts() *components.Accepts {
	if t == nil {
		return nil
	}
	return t.Accepts
}

func (t *TranscodeImageGlobals) GetClientIdentifier() *string {
	if t == nil {
		return nil
	}
	return t.ClientIdentifier
}

func (t *TranscodeImageGlobals) GetProduct() *string {
	if t == nil {
		return nil
	}
	return t.Product
}

func (t *TranscodeImageGlobals) GetVersion() *string {
	if t == nil {
		return nil
	}
	return t.Version
}

func (t *TranscodeImageGlobals) GetPlatform() *string {
	if t == nil {
		return nil
	}
	return t.Platform
}

func (t *TranscodeImageGlobals) GetPlatformVersion() *string {
	if t == nil {
		return nil
	}
	return t.PlatformVersion
}

func (t *TranscodeImageGlobals) GetDevice() *string {
	if t == nil {
		return nil
	}
	return t.Device
}

func (t *TranscodeImageGlobals) GetModel() *string {
	if t == nil {
		return nil
	}
	return t.Model
}

func (t *TranscodeImageGlobals) GetDeviceVendor() *string {
	if t == nil {
		return nil
	}
	return t.DeviceVendor
}

func (t *TranscodeImageGlobals) GetDeviceName() *string {
	if t == nil {
		return nil
	}
	return t.DeviceName
}

func (t *TranscodeImageGlobals) GetMarketplace() *string {
	if t == nil {
		return nil
	}
	return t.Marketplace
}

// Format - The output format for the image; defaults to jpg
type Format string

const (
	FormatJpg  Format = "jpg"
	FormatJpeg Format = "jpeg"
	FormatPng  Format = "png"
	FormatPpm  Format = "ppm"
)

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

// ChromaSubsampling - Use the specified chroma subsambling.
//   - 0: 411
//   - 1: 420
//   - 2: 422
//   - 3: 444
//
// Defaults to 3 (444)
type ChromaSubsampling int64

const (
	ChromaSubsamplingZero  ChromaSubsampling = 0
	ChromaSubsamplingOne   ChromaSubsampling = 1
	ChromaSubsamplingTwo   ChromaSubsampling = 2
	ChromaSubsamplingThree ChromaSubsampling = 3
)

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

type TranscodeImageRequest struct {
	// Indicates the client accepts the indicated media types
	Accepts *components.Accepts `default:"application/xml" header:"style=simple,explode=false,name=accepts"`
	// An opaque identifier unique to the client
	ClientIdentifier *string `header:"style=simple,explode=false,name=X-Plex-Client-Identifier"`
	// The name of the client product
	Product *string `header:"style=simple,explode=false,name=X-Plex-Product"`
	// The version of the client application
	Version *string `header:"style=simple,explode=false,name=X-Plex-Version"`
	// The platform of the client
	Platform *string `header:"style=simple,explode=false,name=X-Plex-Platform"`
	// The version of the platform
	PlatformVersion *string `header:"style=simple,explode=false,name=X-Plex-Platform-Version"`
	// A relatively friendly name for the client device
	Device *string `header:"style=simple,explode=false,name=X-Plex-Device"`
	// A potentially less friendly identifier for the device model
	Model *string `header:"style=simple,explode=false,name=X-Plex-Model"`
	// The device vendor
	DeviceVendor *string `header:"style=simple,explode=false,name=X-Plex-Device-Vendor"`
	// A friendly name for the client
	DeviceName *string `header:"style=simple,explode=false,name=X-Plex-Device-Name"`
	// The marketplace on which the client application is distributed
	Marketplace *string `header:"style=simple,explode=false,name=X-Plex-Marketplace"`
	// The source URL for the image to transcode.  Note, if this URL requires a token such as `X-Plex-Token`, it should be given as a query parameter to this url.
	URL *string `queryParam:"style=form,explode=true,name=url"`
	// The output format for the image; defaults to jpg
	Format *Format `queryParam:"style=form,explode=true,name=format"`
	// The desired width of the output image
	Width *int64 `queryParam:"style=form,explode=true,name=width"`
	// The desired height of the output image
	Height *int64 `queryParam:"style=form,explode=true,name=height"`
	// The desired quality of the output.  -1 means the highest quality.  Defaults to -1
	Quality *int64 `queryParam:"style=form,explode=true,name=quality"`
	// The background color to apply before painting the image.  Only really applicable if image has transparency.  Defaults to none
	Background *string `queryParam:"style=form,explode=true,name=background"`
	// Indicates if image should be upscaled to the desired width/height.  Defaults to false
	Upscale *components.BoolInt `default:"0" queryParam:"style=form,explode=true,name=upscale"`
	// Indicates if image should be scaled to fit the smaller dimension.  By default (false) the image is scaled to fit within the width/height specified but if this parameter is true, it will allow overflowing one dimension to fit the other.  Essentially it is making the width/height minimum sizes of the image or sizing the image to fill the entire width/height even if it overflows one dimension.
	MinSize *components.BoolInt `default:"0" queryParam:"style=form,explode=true,name=minSize"`
	// Obey the rotation values specified in EXIF data.  Defaults to true.
	Rotate *components.BoolInt `default:"0" queryParam:"style=form,explode=true,name=rotate"`
	// Apply a blur to the image, Defaults to 0 (none)
	Blur *int64 `queryParam:"style=form,explode=true,name=blur"`
	// Scale the image saturation by the specified percentage.  Defaults to 100
	Saturation *int64 `queryParam:"style=form,explode=true,name=saturation"`
	// Render the image at the specified opacity percentage.  Defaults to 100
	Opacity *int64 `queryParam:"style=form,explode=true,name=opacity"`
	// Use the specified chroma subsambling.
	//   - 0: 411
	//   - 1: 420
	//   - 2: 422
	//   - 3: 444
	// Defaults to 3 (444)
	ChromaSubsampling *ChromaSubsampling `queryParam:"style=form,explode=true,name=chromaSubsampling"`
	// The color to blend with the image.  Defaults to none
	BlendColor *string `queryParam:"style=form,explode=true,name=blendColor"`
}

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

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

func (t *TranscodeImageRequest) GetAccepts() *components.Accepts {
	if t == nil {
		return nil
	}
	return t.Accepts
}

func (t *TranscodeImageRequest) GetClientIdentifier() *string {
	if t == nil {
		return nil
	}
	return t.ClientIdentifier
}

func (t *TranscodeImageRequest) GetProduct() *string {
	if t == nil {
		return nil
	}
	return t.Product
}

func (t *TranscodeImageRequest) GetVersion() *string {
	if t == nil {
		return nil
	}
	return t.Version
}

func (t *TranscodeImageRequest) GetPlatform() *string {
	if t == nil {
		return nil
	}
	return t.Platform
}

func (t *TranscodeImageRequest) GetPlatformVersion() *string {
	if t == nil {
		return nil
	}
	return t.PlatformVersion
}

func (t *TranscodeImageRequest) GetDevice() *string {
	if t == nil {
		return nil
	}
	return t.Device
}

func (t *TranscodeImageRequest) GetModel() *string {
	if t == nil {
		return nil
	}
	return t.Model
}

func (t *TranscodeImageRequest) GetDeviceVendor() *string {
	if t == nil {
		return nil
	}
	return t.DeviceVendor
}

func (t *TranscodeImageRequest) GetDeviceName() *string {
	if t == nil {
		return nil
	}
	return t.DeviceName
}

func (t *TranscodeImageRequest) GetMarketplace() *string {
	if t == nil {
		return nil
	}
	return t.Marketplace
}

func (t *TranscodeImageRequest) GetURL() *string {
	if t == nil {
		return nil
	}
	return t.URL
}

func (t *TranscodeImageRequest) GetFormat() *Format {
	if t == nil {
		return nil
	}
	return t.Format
}

func (t *TranscodeImageRequest) GetWidth() *int64 {
	if t == nil {
		return nil
	}
	return t.Width
}

func (t *TranscodeImageRequest) GetHeight() *int64 {
	if t == nil {
		return nil
	}
	return t.Height
}

func (t *TranscodeImageRequest) GetQuality() *int64 {
	if t == nil {
		return nil
	}
	return t.Quality
}

func (t *TranscodeImageRequest) GetBackground() *string {
	if t == nil {
		return nil
	}
	return t.Background
}

func (t *TranscodeImageRequest) GetUpscale() *components.BoolInt {
	if t == nil {
		return nil
	}
	return t.Upscale
}

func (t *TranscodeImageRequest) GetMinSize() *components.BoolInt {
	if t == nil {
		return nil
	}
	return t.MinSize
}

func (t *TranscodeImageRequest) GetRotate() *components.BoolInt {
	if t == nil {
		return nil
	}
	return t.Rotate
}

func (t *TranscodeImageRequest) GetBlur() *int64 {
	if t == nil {
		return nil
	}
	return t.Blur
}

func (t *TranscodeImageRequest) GetSaturation() *int64 {
	if t == nil {
		return nil
	}
	return t.Saturation
}

func (t *TranscodeImageRequest) GetOpacity() *int64 {
	if t == nil {
		return nil
	}
	return t.Opacity
}

func (t *TranscodeImageRequest) GetChromaSubsampling() *ChromaSubsampling {
	if t == nil {
		return nil
	}
	return t.ChromaSubsampling
}

func (t *TranscodeImageRequest) GetBlendColor() *string {
	if t == nil {
		return nil
	}
	return t.BlendColor
}

type TranscodeImageResponse struct {
	// HTTP response content type for this operation
	ContentType string
	// HTTP response status code for this operation
	StatusCode int
	// Raw HTTP response; suitable for custom response parsing
	RawResponse *http.Response
	// The resulting image
	// The Close method must be called on this field, even if it is not used, to prevent resource leaks.
	TwoHundredImageJpegResponseStream io.ReadCloser
	// The resulting image
	// The Close method must be called on this field, even if it is not used, to prevent resource leaks.
	TwoHundredImagePngResponseStream io.ReadCloser
	// The resulting image
	// The Close method must be called on this field, even if it is not used, to prevent resource leaks.
	TwoHundredImageXPortablePixmapResponseStream io.ReadCloser
}

func (t *TranscodeImageResponse) GetContentType() string {
	if t == nil {
		return ""
	}
	return t.ContentType
}

func (t *TranscodeImageResponse) GetStatusCode() int {
	if t == nil {
		return 0
	}
	return t.StatusCode
}

func (t *TranscodeImageResponse) GetRawResponse() *http.Response {
	if t == nil {
		return nil
	}
	return t.RawResponse
}

func (t *TranscodeImageResponse) GetTwoHundredImageJpegResponseStream() io.ReadCloser {
	if t == nil {
		return nil
	}
	return t.TwoHundredImageJpegResponseStream
}

func (t *TranscodeImageResponse) GetTwoHundredImagePngResponseStream() io.ReadCloser {
	if t == nil {
		return nil
	}
	return t.TwoHundredImagePngResponseStream
}

func (t *TranscodeImageResponse) GetTwoHundredImageXPortablePixmapResponseStream() io.ReadCloser {
	if t == nil {
		return nil
	}
	return t.TwoHundredImageXPortablePixmapResponseStream
}
