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

package components

import (
	"encoding/json"
	"fmt"
)

// ImageType - Describes both the purpose and intended presentation of the image.
type ImageType string

const (
	ImageTypeBackground  ImageType = "background"
	ImageTypeBanner      ImageType = "banner"
	ImageTypeClearLogo   ImageType = "clearLogo"
	ImageTypeCoverPoster ImageType = "coverPoster"
	ImageTypeSnapshot    ImageType = "snapshot"
)

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

// Image - Images such as movie posters and background artwork are represented by Image elements.
type Image struct {
	// Describes both the purpose and intended presentation of the image.
	Type *ImageType `json:"type,omitempty"`
	// Title to use for accessibility.
	Alt *string `json:"alt,omitempty"`
	// The relative path or absolute url for the image.
	URL *string `json:"url,omitempty"`
}

func (i *Image) GetType() *ImageType {
	if i == nil {
		return nil
	}
	return i.Type
}

func (i *Image) GetAlt() *string {
	if i == nil {
		return nil
	}
	return i.Alt
}

func (i *Image) GetURL() *string {
	if i == nil {
		return nil
	}
	return i.URL
}
