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

import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as types from "../../types/primitives.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import { BrandColor, BrandColor$inboundSchema } from "./brandcolor.js";
import { BrandLogos, BrandLogos$inboundSchema } from "./brandlogos.js";

/**
 * The details of a single workspace brand
 */
export type GetWorkspaceBrandResponse = {
  brandId?: string | null | undefined;
  brandName?: string | null | undefined;
  brandCompany?: string | null | undefined;
  colors: Array<BrandColor> | null;
  logos?: BrandLogos | undefined;
  brandLanguages: Array<string> | null;
  defaultBrandLanguage?: string | null | undefined;
  isSendingDefault?: boolean | undefined;
  isSigningDefault?: boolean | undefined;
  primaryLogoId?: string | null | undefined;
  secondaryLogoId?: string | null | undefined;
  emailLogoId?: string | null | undefined;
};

/** @internal */
export const GetWorkspaceBrandResponse$inboundSchema: z.ZodType<
  GetWorkspaceBrandResponse,
  z.ZodTypeDef,
  unknown
> = z.object({
  brand_id: z.nullable(types.string()).optional(),
  brand_name: z.nullable(types.string()).optional(),
  brand_company: z.nullable(types.string()).optional(),
  colors: types.nullable(z.array(BrandColor$inboundSchema)),
  logos: types.optional(BrandLogos$inboundSchema),
  brand_languages: types.nullable(z.array(types.string())),
  default_brand_language: z.nullable(types.string()).optional(),
  is_sending_default: types.optional(types.boolean()),
  is_signing_default: types.optional(types.boolean()),
  primary_logo_id: z.nullable(types.string()).optional(),
  secondary_logo_id: z.nullable(types.string()).optional(),
  email_logo_id: z.nullable(types.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "brand_id": "brandId",
    "brand_name": "brandName",
    "brand_company": "brandCompany",
    "brand_languages": "brandLanguages",
    "default_brand_language": "defaultBrandLanguage",
    "is_sending_default": "isSendingDefault",
    "is_signing_default": "isSigningDefault",
    "primary_logo_id": "primaryLogoId",
    "secondary_logo_id": "secondaryLogoId",
    "email_logo_id": "emailLogoId",
  });
});

export function getWorkspaceBrandResponseFromJSON(
  jsonString: string,
): SafeParseResult<GetWorkspaceBrandResponse, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GetWorkspaceBrandResponse$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GetWorkspaceBrandResponse' from JSON`,
  );
}
