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

import * as z from "zod/v3";
import {
  V2DeployGitCommit,
  V2DeployGitCommit$Outbound,
  V2DeployGitCommit$outboundSchema,
} from "./v2deploygitcommit.js";

/**
 * Create a deployment from a pre-built Docker image
 */
export type V2DeployCreateDeploymentRequestBody = {
  /**
   * Project slug
   */
  project: string;
  /**
   * App slug within the project
   */
  app: string;
  /**
   * Optional keyspace ID for authentication context
   */
  keyspaceId?: string | undefined;
  /**
   * Git branch name
   */
  branch: string;
  /**
   * Environment slug (e.g., "production", "staging")
   */
  environmentSlug: string;
  /**
   * Docker image reference to deploy
   */
  dockerImage: string;
  /**
   * Optional git commit information
   */
  gitCommit?: V2DeployGitCommit | undefined;
};

/** @internal */
export type V2DeployCreateDeploymentRequestBody$Outbound = {
  project: string;
  app: string;
  keyspaceId?: string | undefined;
  branch: string;
  environmentSlug: string;
  dockerImage: string;
  gitCommit?: V2DeployGitCommit$Outbound | undefined;
};

/** @internal */
export const V2DeployCreateDeploymentRequestBody$outboundSchema: z.ZodType<
  V2DeployCreateDeploymentRequestBody$Outbound,
  z.ZodTypeDef,
  V2DeployCreateDeploymentRequestBody
> = z.object({
  project: z.string(),
  app: z.string(),
  keyspaceId: z.string().optional(),
  branch: z.string(),
  environmentSlug: z.string(),
  dockerImage: z.string(),
  gitCommit: V2DeployGitCommit$outboundSchema.optional(),
});

export function v2DeployCreateDeploymentRequestBodyToJSON(
  v2DeployCreateDeploymentRequestBody: V2DeployCreateDeploymentRequestBody,
): string {
  return JSON.stringify(
    V2DeployCreateDeploymentRequestBody$outboundSchema.parse(
      v2DeployCreateDeploymentRequestBody,
    ),
  );
}
