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

import * as z from "zod/v3";

/**
 * The image type
 */
export enum Format {
  Jpg = "jpg",
  Png = "png",
}

/**
 * Where to crop source images to fit into composite image proportions
 */
export enum Crop {
  Center = "center",
  Top = "top",
}

/**
 * The default image type to use as the sources
 */
export enum MediaEnum {
  Thumb = "thumb",
  Art = "art",
  Banner = "banner",
}

export type Composite = {
  /**
   * Limit composite to specified metadata types
   */
  type?: number | undefined;
  /**
   * The image type
   */
  format?: Format | undefined;
  /**
   * 6 character hex RGB value for background color for image
   */
  backgroundColor?: string | undefined;
  /**
   * The width of the intra-image border
   */
  border?: number | undefined;
  /**
   * Number of columns to construct in the composite image
   */
  cols?: number | undefined;
  /**
   * Where to crop source images to fit into composite image proportions
   */
  crop?: Crop | undefined;
  /**
   * The height of the image
   */
  height?: number | undefined;
  /**
   * The default image type to use as the sources
   */
  media?: MediaEnum | undefined;
  /**
   * Allow repetion of images if there are not enough source images to fill grid
   */
  repeat?: boolean | undefined;
  /**
   * Number of rows to construct in the composite image
   */
  rows?: number | undefined;
  /**
   * The width of the image
   */
  width?: number | undefined;
};

/** @internal */
export const Format$outboundSchema: z.ZodNativeEnum<typeof Format> = z
  .nativeEnum(Format);

/** @internal */
export const Crop$outboundSchema: z.ZodNativeEnum<typeof Crop> = z.nativeEnum(
  Crop,
);

/** @internal */
export const MediaEnum$outboundSchema: z.ZodNativeEnum<typeof MediaEnum> = z
  .nativeEnum(MediaEnum);

/** @internal */
export type Composite$Outbound = {
  type?: number | undefined;
  format?: string | undefined;
  backgroundColor?: string | undefined;
  border?: number | undefined;
  cols?: number | undefined;
  crop?: string | undefined;
  height?: number | undefined;
  media?: string | undefined;
  repeat?: boolean | undefined;
  rows?: number | undefined;
  width?: number | undefined;
};

/** @internal */
export const Composite$outboundSchema: z.ZodType<
  Composite$Outbound,
  z.ZodTypeDef,
  Composite
> = z.object({
  type: z.number().int().optional(),
  format: Format$outboundSchema.optional(),
  backgroundColor: z.string().optional(),
  border: z.number().int().optional(),
  cols: z.number().int().optional(),
  crop: Crop$outboundSchema.optional(),
  height: z.number().int().optional(),
  media: MediaEnum$outboundSchema.optional(),
  repeat: z.boolean().optional(),
  rows: z.number().int().optional(),
  width: z.number().int().optional(),
});

export function compositeToJSON(composite: Composite): string {
  return JSON.stringify(Composite$outboundSchema.parse(composite));
}
