/*
 * 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 {
  WorkspaceUploadRequestAssignment,
  WorkspaceUploadRequestAssignment$Outbound,
  WorkspaceUploadRequestAssignment$outboundSchema,
} from "./workspaceuploadrequestassignment.js";
import {
  WorkspaceUploadRequestDocument,
  WorkspaceUploadRequestDocument$Outbound,
  WorkspaceUploadRequestDocument$outboundSchema,
} from "./workspaceuploadrequestdocument.js";
import {
  WorkspaceUploadRequestOwner,
  WorkspaceUploadRequestOwner$Outbound,
  WorkspaceUploadRequestOwner$outboundSchema,
} from "./workspaceuploadrequestowner.js";
import {
  WorkspaceUploadRequestStatus,
  WorkspaceUploadRequestStatus$outboundSchema,
} from "./workspaceuploadrequeststatus.js";

/**
 * Upload request details for update operations
 */
export type UpdateWorkspaceUploadRequestBody = {
  /**
   * The ID of the upload request
   */
  uploadRequestId?: string | null | undefined;
  /**
   * The ID of the workspace
   */
  workspaceId?: string | null | undefined;
  /**
   * The name of the upload request (editable)
   */
  name: string | null;
  /**
   * The description of the upload request (editable)
   */
  description: string | null;
  uploadRequestOwner?: WorkspaceUploadRequestOwner | undefined;
  /**
   * Enum representing the status of a workspace upload request
   */
  status: WorkspaceUploadRequestStatus;
  /**
   * List of documents associated with the upload request
   */
  documents?: Array<WorkspaceUploadRequestDocument> | null | undefined;
  /**
   * List of user assignments for the upload request
   */
  assignments?: Array<WorkspaceUploadRequestAssignment> | null | undefined;
  /**
   * The date the upload request was created
   */
  createdDate?: string | null | undefined;
  /**
   * The date the upload request was last updated
   */
  updatedDate?: string | null | undefined;
  /**
   * The due date for the upload request (editable)
   */
  dueDate: Date;
  /**
   * The date the upload request was sent
   */
  sentDate?: string | null | undefined;
  /**
   * The date the upload request was completed
   */
  completedDate?: string | null | undefined;
  /**
   * Whether the current user can view the upload request
   */
  canView?: boolean | null | undefined;
  /**
   * Whether the current user can edit the upload request
   */
  canEdit?: boolean | null | undefined;
  /**
   * Whether the current user can delete the upload request
   */
  canDelete?: boolean | null | undefined;
};

/** @internal */
export type UpdateWorkspaceUploadRequestBody$Outbound = {
  upload_request_id?: string | null | undefined;
  workspace_id?: string | null | undefined;
  name: string | null;
  description: string | null;
  upload_request_owner?: WorkspaceUploadRequestOwner$Outbound | undefined;
  status: string;
  documents?: Array<WorkspaceUploadRequestDocument$Outbound> | null | undefined;
  assignments?:
    | Array<WorkspaceUploadRequestAssignment$Outbound>
    | null
    | undefined;
  created_date?: string | null | undefined;
  updated_date?: string | null | undefined;
  due_date: string;
  sent_date?: string | null | undefined;
  completed_date?: string | null | undefined;
  can_view?: boolean | null | undefined;
  can_edit?: boolean | null | undefined;
  can_delete?: boolean | null | undefined;
};

/** @internal */
export const UpdateWorkspaceUploadRequestBody$outboundSchema: z.ZodType<
  UpdateWorkspaceUploadRequestBody$Outbound,
  z.ZodTypeDef,
  UpdateWorkspaceUploadRequestBody
> = z.object({
  uploadRequestId: z.nullable(z.string()).optional(),
  workspaceId: z.nullable(z.string()).optional(),
  name: z.nullable(z.string()),
  description: z.nullable(z.string()),
  uploadRequestOwner: WorkspaceUploadRequestOwner$outboundSchema.optional(),
  status: WorkspaceUploadRequestStatus$outboundSchema,
  documents: z.nullable(z.array(WorkspaceUploadRequestDocument$outboundSchema))
    .optional(),
  assignments: z.nullable(
    z.array(WorkspaceUploadRequestAssignment$outboundSchema),
  ).optional(),
  createdDate: z.nullable(z.string()).optional(),
  updatedDate: z.nullable(z.string()).optional(),
  dueDate: z.date().transform(v => v.toISOString()),
  sentDate: z.nullable(z.string()).optional(),
  completedDate: z.nullable(z.string()).optional(),
  canView: z.nullable(z.boolean()).optional(),
  canEdit: z.nullable(z.boolean()).optional(),
  canDelete: z.nullable(z.boolean()).optional(),
}).transform((v) => {
  return remap$(v, {
    uploadRequestId: "upload_request_id",
    workspaceId: "workspace_id",
    uploadRequestOwner: "upload_request_owner",
    createdDate: "created_date",
    updatedDate: "updated_date",
    dueDate: "due_date",
    sentDate: "sent_date",
    completedDate: "completed_date",
    canView: "can_view",
    canEdit: "can_edit",
    canDelete: "can_delete",
  });
});

export function updateWorkspaceUploadRequestBodyToJSON(
  updateWorkspaceUploadRequestBody: UpdateWorkspaceUploadRequestBody,
): string {
  return JSON.stringify(
    UpdateWorkspaceUploadRequestBody$outboundSchema.parse(
      updateWorkspaceUploadRequestBody,
    ),
  );
}
