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

package components

import (
	"encoding/json"
	"fmt"
)

// Format - The image type
type Format string

const (
	FormatJpg Format = "jpg"
	FormatPng Format = "png"
)

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 "png":
		*e = Format(v)
		return nil
	default:
		return fmt.Errorf("invalid value for Format: %v", v)
	}
}

// Crop - Where to crop source images to fit into composite image proportions
type Crop string

const (
	CropCenter Crop = "center"
	CropTop    Crop = "top"
)

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

// CompositeMedia - The default image type to use as the sources
type CompositeMedia string

const (
	CompositeMediaThumb  CompositeMedia = "thumb"
	CompositeMediaArt    CompositeMedia = "art"
	CompositeMediaBanner CompositeMedia = "banner"
)

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

type Composite struct {
	// Limit composite to specified metadata types
	Type *int64 `queryParam:"name=type"`
	// The image type
	Format *Format `queryParam:"name=format"`
	// 6 character hex RGB value for background color for image
	BackgroundColor *string `queryParam:"name=backgroundColor"`
	// The width of the intra-image border
	Border *int64 `queryParam:"name=border"`
	// Number of columns to construct in the composite image
	Cols *int64 `queryParam:"name=cols"`
	// Where to crop source images to fit into composite image proportions
	Crop *Crop `queryParam:"name=crop"`
	// The height of the image
	Height *int64 `queryParam:"name=height"`
	// The default image type to use as the sources
	Media *CompositeMedia `queryParam:"name=media"`
	// Allow repetion of images if there are not enough source images to fill grid
	Repeat *bool `queryParam:"name=repeat"`
	// Number of rows to construct in the composite image
	Rows *int64 `queryParam:"name=rows"`
	// The width of the image
	Width *int64 `queryParam:"name=width"`
}

func (c *Composite) GetType() *int64 {
	if c == nil {
		return nil
	}
	return c.Type
}

func (c *Composite) GetFormat() *Format {
	if c == nil {
		return nil
	}
	return c.Format
}

func (c *Composite) GetBackgroundColor() *string {
	if c == nil {
		return nil
	}
	return c.BackgroundColor
}

func (c *Composite) GetBorder() *int64 {
	if c == nil {
		return nil
	}
	return c.Border
}

func (c *Composite) GetCols() *int64 {
	if c == nil {
		return nil
	}
	return c.Cols
}

func (c *Composite) GetCrop() *Crop {
	if c == nil {
		return nil
	}
	return c.Crop
}

func (c *Composite) GetHeight() *int64 {
	if c == nil {
		return nil
	}
	return c.Height
}

func (c *Composite) GetMedia() *CompositeMedia {
	if c == nil {
		return nil
	}
	return c.Media
}

func (c *Composite) GetRepeat() *bool {
	if c == nil {
		return nil
	}
	return c.Repeat
}

func (c *Composite) GetRows() *int64 {
	if c == nil {
		return nil
	}
	return c.Rows
}

func (c *Composite) GetWidth() *int64 {
	if c == nil {
		return nil
	}
	return c.Width
}
