/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 1268562a8b7c
 */

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import {
  ScheduleDefinition,
  ScheduleDefinition$Outbound,
  ScheduleDefinition$outboundSchema,
} from "./scheduledefinition.js";

export type WorkflowScheduleRequest = {
  /**
   * Specification of the times scheduled actions may occur.
   *
   * @remarks
   *
   * The times are the union of :py:attr:`calendars`, :py:attr:`intervals`, and
   * :py:attr:`cron_expressions` excluding anything in :py:attr:`skip`.
   *
   * Used for input where schedule_id is optional (can be provided or auto-generated).
   */
  schedule: ScheduleDefinition;
  /**
   * The ID of the workflow registration to schedule
   */
  workflowRegistrationId?: string | null | undefined;
  /**
   * Deprecated: use workflow_registration_id
   */
  workflowVersionId?: string | null | undefined;
  /**
   * The name or ID of the workflow to schedule
   */
  workflowIdentifier?: string | null | undefined;
  /**
   * Deprecated. Use deployment_name instead.
   *
   * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
   */
  workflowTaskQueue?: string | null | undefined;
  /**
   * Allows you to specify a custom schedule ID. If not provided, a random ID will be generated.
   */
  scheduleId?: string | null | undefined;
  /**
   * Name of the deployment to route this schedule to
   */
  deploymentName?: string | null | undefined;
};

/** @internal */
export type WorkflowScheduleRequest$Outbound = {
  schedule: ScheduleDefinition$Outbound;
  workflow_registration_id?: string | null | undefined;
  workflow_version_id?: string | null | undefined;
  workflow_identifier?: string | null | undefined;
  workflow_task_queue?: string | null | undefined;
  schedule_id?: string | null | undefined;
  deployment_name?: string | null | undefined;
};

/** @internal */
export const WorkflowScheduleRequest$outboundSchema: z.ZodType<
  WorkflowScheduleRequest$Outbound,
  WorkflowScheduleRequest
> = z.object({
  schedule: ScheduleDefinition$outboundSchema,
  workflowRegistrationId: z.nullable(z.string()).optional(),
  workflowVersionId: z.nullable(z.string()).optional(),
  workflowIdentifier: z.nullable(z.string()).optional(),
  workflowTaskQueue: z.nullable(z.string()).optional(),
  scheduleId: z.nullable(z.string()).optional(),
  deploymentName: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    workflowRegistrationId: "workflow_registration_id",
    workflowVersionId: "workflow_version_id",
    workflowIdentifier: "workflow_identifier",
    workflowTaskQueue: "workflow_task_queue",
    scheduleId: "schedule_id",
    deploymentName: "deployment_name",
  });
});

export function workflowScheduleRequestToJSON(
  workflowScheduleRequest: WorkflowScheduleRequest,
): string {
  return JSON.stringify(
    WorkflowScheduleRequest$outboundSchema.parse(workflowScheduleRequest),
  );
}
