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

import * as z from "zod/v4-mini";
import { remap as remap$ } from "../../lib/primitives.js";
import {
  S3FileCreateMultipart,
  S3FileCreateMultipart$Outbound,
  S3FileCreateMultipart$outboundSchema,
} from "./s3filecreatemultipart.js";

/**
 * Schema to create a file attached to a support case.
 */
export type SupportCaseAttachmentFileCreate = {
  organizationId?: string | null | undefined;
  name: string;
  /**
   * MIME type of the file. Images, videos, PDF, CSV, plain text, Word and Excel documents are supported.
   */
  mimeType: string;
  /**
   * Size of the file. A maximum of 250 MB is allowed for this type of file.
   */
  size: number;
  checksumSha256Base64?: string | null | undefined;
  upload: S3FileCreateMultipart;
  service: "support_case_attachment";
  version?: string | null | undefined;
};

/** @internal */
export type SupportCaseAttachmentFileCreate$Outbound = {
  organization_id?: string | null | undefined;
  name: string;
  mime_type: string;
  size: number;
  checksum_sha256_base64?: string | null | undefined;
  upload: S3FileCreateMultipart$Outbound;
  service: "support_case_attachment";
  version?: string | null | undefined;
};

/** @internal */
export const SupportCaseAttachmentFileCreate$outboundSchema: z.ZodMiniType<
  SupportCaseAttachmentFileCreate$Outbound,
  SupportCaseAttachmentFileCreate
> = z.pipe(
  z.object({
    organizationId: z.optional(z.nullable(z.string())),
    name: z.string(),
    mimeType: z.string(),
    size: z.int(),
    checksumSha256Base64: z.optional(z.nullable(z.string())),
    upload: S3FileCreateMultipart$outboundSchema,
    service: z.literal("support_case_attachment"),
    version: z.optional(z.nullable(z.string())),
  }),
  z.transform((v) => {
    return remap$(v, {
      organizationId: "organization_id",
      mimeType: "mime_type",
      checksumSha256Base64: "checksum_sha256_base64",
    });
  }),
);

export function supportCaseAttachmentFileCreateToJSON(
  supportCaseAttachmentFileCreate: SupportCaseAttachmentFileCreate,
): string {
  return JSON.stringify(
    SupportCaseAttachmentFileCreate$outboundSchema.parse(
      supportCaseAttachmentFileCreate,
    ),
  );
}
