// 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"
	"net/http"
)

var GetServerResourcesServerList = []string{
	"https://plex.tv/api/v2",
}

type GetServerResourcesGlobals 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"`
}

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

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

func (g *GetServerResourcesGlobals) GetAccepts() *components.Accepts {
	if g == nil {
		return nil
	}
	return g.Accepts
}

func (g *GetServerResourcesGlobals) GetClientIdentifier() *string {
	if g == nil {
		return nil
	}
	return g.ClientIdentifier
}

// IncludeHTTPS - Include Https entries in the results
type IncludeHTTPS int

const (
	IncludeHTTPSFalse IncludeHTTPS = 0
	IncludeHTTPSTrue  IncludeHTTPS = 1
)

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

// IncludeRelay - Include Relay addresses in the results
// E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
type IncludeRelay int

const (
	IncludeRelayFalse IncludeRelay = 0
	IncludeRelayTrue  IncludeRelay = 1
)

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

// IncludeIPv6 - Include IPv6 entries in the results
type IncludeIPv6 int

const (
	IncludeIPv6False IncludeIPv6 = 0
	IncludeIPv6True  IncludeIPv6 = 1
)

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

type GetServerResourcesRequest 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"`
	// Include Https entries in the results
	IncludeHTTPS *IncludeHTTPS `default:"0" queryParam:"style=form,explode=true,name=includeHttps"`
	// Include Relay addresses in the results
	// E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
	//
	IncludeRelay *IncludeRelay `default:"0" queryParam:"style=form,explode=true,name=includeRelay"`
	// Include IPv6 entries in the results
	IncludeIPv6 *IncludeIPv6 `default:"0" queryParam:"style=form,explode=true,name=includeIPv6"`
}

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

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

func (g *GetServerResourcesRequest) GetAccepts() *components.Accepts {
	if g == nil {
		return nil
	}
	return g.Accepts
}

func (g *GetServerResourcesRequest) GetClientIdentifier() *string {
	if g == nil {
		return nil
	}
	return g.ClientIdentifier
}

func (g *GetServerResourcesRequest) GetIncludeHTTPS() *IncludeHTTPS {
	if g == nil {
		return nil
	}
	return g.IncludeHTTPS
}

func (g *GetServerResourcesRequest) GetIncludeRelay() *IncludeRelay {
	if g == nil {
		return nil
	}
	return g.IncludeRelay
}

func (g *GetServerResourcesRequest) GetIncludeIPv6() *IncludeIPv6 {
	if g == nil {
		return nil
	}
	return g.IncludeIPv6
}

type GetServerResourcesResponse 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
	// List of Plex Devices. This includes Plex hosted servers and clients
	PlexDevices []components.PlexDevice
}

func (g *GetServerResourcesResponse) GetContentType() string {
	if g == nil {
		return ""
	}
	return g.ContentType
}

func (g *GetServerResourcesResponse) GetStatusCode() int {
	if g == nil {
		return 0
	}
	return g.StatusCode
}

func (g *GetServerResourcesResponse) GetRawResponse() *http.Response {
	if g == nil {
		return nil
	}
	return g.RawResponse
}

func (g *GetServerResourcesResponse) GetPlexDevices() []components.PlexDevice {
	if g == nil {
		return nil
	}
	return g.PlexDevices
}
