/*
 * 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 { ClosedEnum } from "../types/enums.js";
import { smartUnion } from "../types/smartUnion.js";

export type PatchTeamRoles2 = {
  accessGroupId: string;
};

export const PatchTeamRoles1 = {
  Owner: "OWNER",
  Member: "MEMBER",
  Developer: "DEVELOPER",
  Security: "SECURITY",
  Billing: "BILLING",
  Viewer: "VIEWER",
  ViewerForPlus: "VIEWER_FOR_PLUS",
  Contributor: "CONTRIBUTOR",
} as const;
export type PatchTeamRoles1 = ClosedEnum<typeof PatchTeamRoles1>;

export type PatchTeamRoles = PatchTeamRoles2 | PatchTeamRoles1;

export type PatchTeamSaml = {
  /**
   * Require that members of the team use SAML Single Sign-On.
   */
  enforced?: boolean | undefined;
  /**
   * Directory groups to role or access group mappings.
   */
  roles?: { [k: string]: PatchTeamRoles2 | PatchTeamRoles1 } | undefined;
};

/**
 * Whether or not remote caching is enabled for the team
 */
export type PatchTeamRemoteCaching = {
  /**
   * Enable or disable remote caching for the team.
   */
  enabled?: boolean | undefined;
};

/**
 * Controls who can request access to protected deployments.
 */
export const PatchTeamDpAccessRequestsMode = {
  All: "all",
  None: "none",
  EmailDomain: "email-domain",
} as const;
/**
 * Controls who can request access to protected deployments.
 */
export type PatchTeamDpAccessRequestsMode = ClosedEnum<
  typeof PatchTeamDpAccessRequestsMode
>;

/**
 * Specify if the password will apply to every Deployment Target or just Preview
 */
export const PatchTeamDeploymentType = {
  All: "all",
  Preview: "preview",
  ProdDeploymentUrlsAndAllPreviews: "prod_deployment_urls_and_all_previews",
  AllExceptCustomDomains: "all_except_custom_domains",
} as const;
/**
 * Specify if the password will apply to every Deployment Target or just Preview
 */
export type PatchTeamDeploymentType = ClosedEnum<
  typeof PatchTeamDeploymentType
>;

/**
 * Allows to protect project deployments with a password
 */
export type PatchTeamPasswordProtection = {
  /**
   * Specify if the password will apply to every Deployment Target or just Preview
   */
  deploymentType: PatchTeamDeploymentType;
  /**
   * The password that will be used to protect Project Deployments
   */
  password?: string | null | undefined;
};

/**
 * Specify if the Vercel Authentication (SSO Protection) will apply to every Deployment Target or just Preview
 */
export const PatchTeamTeamsDeploymentType = {
  All: "all",
  Preview: "preview",
  ProdDeploymentUrlsAndAllPreviews: "prod_deployment_urls_and_all_previews",
  AllExceptCustomDomains: "all_except_custom_domains",
} as const;
/**
 * Specify if the Vercel Authentication (SSO Protection) will apply to every Deployment Target or just Preview
 */
export type PatchTeamTeamsDeploymentType = ClosedEnum<
  typeof PatchTeamTeamsDeploymentType
>;

/**
 * Ensures visitors to your Preview Deployments are logged into Vercel and have a minimum of Viewer access on your team
 */
export type PatchTeamSsoProtection = {
  /**
   * Specify if the Vercel Authentication (SSO Protection) will apply to every Deployment Target or just Preview
   */
  deploymentType?: PatchTeamTeamsDeploymentType | undefined;
};

/**
 * Default deployment protection settings for new projects.
 */
export type PatchTeamDefaultDeploymentProtection = {
  /**
   * Allows to protect project deployments with a password
   */
  passwordProtection?: PatchTeamPasswordProtection | null | undefined;
  /**
   * Ensures visitors to your Preview Deployments are logged into Vercel and have a minimum of Viewer access on your team
   */
  ssoProtection?: PatchTeamSsoProtection | null | undefined;
};

export const PatchTeamTeamsRequestDeploymentType = {
  All: "all",
  Preview: "preview",
  ProdDeploymentUrlsAndAllPreviews: "prod_deployment_urls_and_all_previews",
  AllExceptCustomDomains: "all_except_custom_domains",
} as const;
export type PatchTeamTeamsRequestDeploymentType = ClosedEnum<
  typeof PatchTeamTeamsRequestDeploymentType
>;

/**
 * Default Passport configuration for new projects.
 */
export type PatchTeamDefaultPassport = {
  connectorId: string;
  deploymentType: PatchTeamTeamsRequestDeploymentType;
};

/**
 * The time period to keep non-production deployments for
 */
export const PatchTeamExpiration = {
  Threey: "3y",
  Twoy: "2y",
  Oney: "1y",
  Sixm: "6m",
  Threem: "3m",
  Twom: "2m",
  Onem: "1m",
  Twow: "2w",
  Onew: "1w",
  Oned: "1d",
  Unlimited: "unlimited",
} as const;
/**
 * The time period to keep non-production deployments for
 */
export type PatchTeamExpiration = ClosedEnum<typeof PatchTeamExpiration>;

/**
 * The time period to keep production deployments for
 */
export const ExpirationProduction = {
  Threey: "3y",
  Twoy: "2y",
  Oney: "1y",
  Sixm: "6m",
  Threem: "3m",
  Twom: "2m",
  Onem: "1m",
  Twow: "2w",
  Onew: "1w",
  Oned: "1d",
  Unlimited: "unlimited",
} as const;
/**
 * The time period to keep production deployments for
 */
export type ExpirationProduction = ClosedEnum<typeof ExpirationProduction>;

/**
 * The time period to keep canceled deployments for
 */
export const ExpirationCanceled = {
  Oney: "1y",
  Sixm: "6m",
  Threem: "3m",
  Twom: "2m",
  Onem: "1m",
  Twow: "2w",
  Onew: "1w",
  Oned: "1d",
  Unlimited: "unlimited",
} as const;
/**
 * The time period to keep canceled deployments for
 */
export type ExpirationCanceled = ClosedEnum<typeof ExpirationCanceled>;

/**
 * The time period to keep errored deployments for
 */
export const ExpirationErrored = {
  Oney: "1y",
  Sixm: "6m",
  Threem: "3m",
  Twom: "2m",
  Onem: "1m",
  Twow: "2w",
  Onew: "1w",
  Oned: "1d",
  Unlimited: "unlimited",
} as const;
/**
 * The time period to keep errored deployments for
 */
export type ExpirationErrored = ClosedEnum<typeof ExpirationErrored>;

export type PatchTeamDefaultExpirationSettings = {
  /**
   * The time period to keep non-production deployments for
   */
  expiration?: PatchTeamExpiration | undefined;
  /**
   * The time period to keep production deployments for
   */
  expirationProduction?: ExpirationProduction | undefined;
  /**
   * The time period to keep canceled deployments for
   */
  expirationCanceled?: ExpirationCanceled | undefined;
  /**
   * The time period to keep errored deployments for
   */
  expirationErrored?: ExpirationErrored | undefined;
};

export type PatchTeamEnvironments2 = {
  type: "custom";
  environmentId: string;
};

export const PatchTeamEnvironmentsTarget = {
  Production: "production",
  Preview: "preview",
} as const;
export type PatchTeamEnvironmentsTarget = ClosedEnum<
  typeof PatchTeamEnvironmentsTarget
>;

export type PatchTeamEnvironments1 = {
  type: "system";
  target: PatchTeamEnvironmentsTarget;
};

export type PatchTeamGitSourcesEnvironments =
  | PatchTeamEnvironments1
  | PatchTeamEnvironments2;

export type PatchTeamSources2 = {
  provider: "gitlab";
  namespace: string;
  project?: string | undefined;
};

export const PatchTeamSourcesProvider = {
  Github: "github",
  Bitbucket: "bitbucket",
} as const;
export type PatchTeamSourcesProvider = ClosedEnum<
  typeof PatchTeamSourcesProvider
>;

export type PatchTeamSources1 = {
  provider: PatchTeamSourcesProvider;
  org: string;
  repo?: string | undefined;
};

export type PatchTeamGitSourcesSources =
  | (PatchTeamSources1 & { provider: "github" })
  | (PatchTeamSources1 & { provider: "bitbucket" })
  | PatchTeamSources2;

export type PatchTeamGitSources1 = {
  enabled: boolean;
  environments: Array<PatchTeamEnvironments1 | PatchTeamEnvironments2>;
  sources: Array<
    | (PatchTeamSources1 & { provider: "github" })
    | (PatchTeamSources1 & { provider: "bitbucket" })
    | PatchTeamSources2
  >;
};

export type PatchTeamDeploymentPolicyGitSources =
  | Array<PatchTeamGitSources1>
  | string;

export type PatchTeamEnvironmentsTeams2 = {
  type: "custom";
  environmentId: string;
};

export const PatchTeamEnvironmentsTeamsTarget = {
  Production: "production",
  Preview: "preview",
} as const;
export type PatchTeamEnvironmentsTeamsTarget = ClosedEnum<
  typeof PatchTeamEnvironmentsTeamsTarget
>;

export type PatchTeamEnvironmentsTeams1 = {
  type: "system";
  target: PatchTeamEnvironmentsTeamsTarget;
};

export type PatchTeamDeploymentSourcesEnvironments =
  | PatchTeamEnvironmentsTeams1
  | PatchTeamEnvironmentsTeams2;

export const PatchTeamDeploymentSourcesSources = {
  Git: "git",
  Cli: "cli",
  RestApi: "rest-api",
  DeployHook: "deploy-hook",
  Integration: "integration",
  V0: "v0",
} as const;
export type PatchTeamDeploymentSourcesSources = ClosedEnum<
  typeof PatchTeamDeploymentSourcesSources
>;

export type PatchTeamDeploymentSources1 = {
  enabled: boolean;
  environments: Array<
    PatchTeamEnvironmentsTeams1 | PatchTeamEnvironmentsTeams2
  >;
  sources: Array<PatchTeamDeploymentSourcesSources>;
};

export type PatchTeamDeploymentPolicyDeploymentSources =
  | Array<PatchTeamDeploymentSources1>
  | string;

/**
 * Composable deployment-time policy. Each rule type holds a list of rules, one per environment scope.
 */
export type PatchTeamDeploymentPolicy1 = {
  gitSources?: Array<PatchTeamGitSources1> | string | undefined;
  deploymentSources?: Array<PatchTeamDeploymentSources1> | string | undefined;
};

export type PatchTeamDeploymentPolicy = PatchTeamDeploymentPolicy1 | string;

/**
 * When enabled, deployment protection settings require stricter permissions (owner-only).
 */
export type PatchTeamStrictDeploymentProtectionSettings = {
  /**
   * Enable or disable strict deployment protection settings.
   */
  enabled: boolean;
};

/**
 * When enabled, creating shareable links requires Owner role.
 */
export type PatchTeamStrictShareableLinks = {
  /**
   * Enable or disable requiring Owner role to create shareable links.
   */
  enabled: boolean;
};

/**
 * The NSNB preference for the team.
 */
export const NsnbConfigPreference = {
  AutoApproval: "auto-approval",
  ManualApproval: "manual-approval",
  Block: "block",
} as const;
/**
 * The NSNB preference for the team.
 */
export type NsnbConfigPreference = ClosedEnum<typeof NsnbConfigPreference>;

/**
 * NSNB configuration for the team.
 */
export type NsnbConfig1 = {
  /**
   * The NSNB preference for the team.
   */
  preference: NsnbConfigPreference;
};

export type PatchTeamNsnbConfig = NsnbConfig1 | string;

export type DefaultProjectJobsLint = {
  targets: Array<string>;
};

export type DefaultProjectJobsTypecheck = {
  targets: Array<string>;
};

/**
 * Default job configuration applied to new projects created in this team.
 */
export type DefaultProjectJobs1 = {
  lint?: DefaultProjectJobsLint | undefined;
  typecheck?: DefaultProjectJobsTypecheck | undefined;
};

export type PatchTeamDefaultProjectJobs = DefaultProjectJobs1 | string;

/**
 * Default build machine type for new builds: standard, enhanced, turbo, or elastic.
 */
export const PatchTeamDefault = {
  Enhanced: "enhanced",
  Turbo: "turbo",
  Standard: "standard",
  Elastic: "elastic",
} as const;
/**
 * Default build machine type for new builds: standard, enhanced, turbo, or elastic.
 */
export type PatchTeamDefault = ClosedEnum<typeof PatchTeamDefault>;

/**
 * Build machine configuration.
 */
export type PatchTeamBuildMachine = {
  /**
   * Default build machine type for new builds: standard, enhanced, turbo, or elastic.
   */
  default?: PatchTeamDefault | undefined;
};

/**
 * Resource configuration for the team.
 */
export type PatchTeamResourceConfig = {
  /**
   * Build machine configuration.
   */
  buildMachine?: PatchTeamBuildMachine | undefined;
};

export type PatchTeamRequestBody = {
  /**
   * The hash value of an uploaded image.
   */
  avatar?: string | undefined;
  /**
   * A short text that describes the team.
   */
  description?: string | undefined;
  emailDomain?: string | null | undefined;
  /**
   * The name of the team.
   */
  name?: string | undefined;
  /**
   * Suffix that will be used for all preview deployments.
   */
  previewDeploymentSuffix?: string | null | undefined;
  /**
   * Create a new invite code and replace the current one.
   */
  regenerateInviteCode?: boolean | undefined;
  saml?: PatchTeamSaml | undefined;
  /**
   * A new slug for the team.
   */
  slug?: string | undefined;
  /**
   * Enable preview toolbar: one of on, off or default.
   */
  enablePreviewFeedback?: string | undefined;
  /**
   * Enable production toolbar: one of on, off or default.
   */
  enableProductionFeedback?: string | undefined;
  /**
   * Sensitive environment variable policy: one of on, off or default.
   */
  sensitiveEnvironmentVariablePolicy?: string | undefined;
  /**
   * Whether or not remote caching is enabled for the team
   */
  remoteCaching?: PatchTeamRemoteCaching | undefined;
  /**
   * Display or hide IP addresses in Monitoring queries.
   */
  hideIpAddresses?: boolean | undefined;
  /**
   * Display or hide IP addresses in Log Drains.
   */
  hideIpAddressesInLogDrains?: boolean | undefined;
  /**
   * Controls who can request access to protected deployments.
   */
  dpAccessRequestsMode?: PatchTeamDpAccessRequestsMode | undefined;
  /**
   * When enabled, all projects in the team require commits to be signed and verified by the git provider before deployments will be created.
   */
  requireVerifiedCommits?: boolean | undefined;
  /**
   * Default for projects in the team. When `true`, projects in this team will not emit GitHub repository-dispatch events on deployment events unless the project explicitly overrides this setting.
   */
  disableRepositoryDispatchEvents?: boolean | undefined;
  /**
   * Default deployment protection settings for new projects.
   */
  defaultDeploymentProtection?:
    | PatchTeamDefaultDeploymentProtection
    | undefined;
  /**
   * Default Passport configuration for new projects.
   */
  defaultPassport?: PatchTeamDefaultPassport | null | undefined;
  defaultExpirationSettings?: PatchTeamDefaultExpirationSettings | undefined;
  deploymentPolicy?: PatchTeamDeploymentPolicy1 | string | undefined;
  /**
   * When enabled, deployment protection settings require stricter permissions (owner-only).
   */
  strictDeploymentProtectionSettings?:
    | PatchTeamStrictDeploymentProtectionSettings
    | undefined;
  /**
   * When enabled, creating shareable links requires Owner role.
   */
  strictShareableLinks?: PatchTeamStrictShareableLinks | undefined;
  nsnbConfig?: NsnbConfig1 | string | undefined;
  defaultProjectJobs?: DefaultProjectJobs1 | string | undefined;
  /**
   * Resource configuration for the team.
   */
  resourceConfig?: PatchTeamResourceConfig | undefined;
};

export type PatchTeamRequest = {
  /**
   * The Team identifier to perform the request on behalf of.
   */
  teamId: string;
  /**
   * The Team slug to perform the request on behalf of.
   */
  slug?: string | undefined;
  requestBody: PatchTeamRequestBody;
};

/** @internal */
export type PatchTeamRoles2$Outbound = {
  accessGroupId: string;
};

/** @internal */
export const PatchTeamRoles2$outboundSchema: z.ZodType<
  PatchTeamRoles2$Outbound,
  z.ZodTypeDef,
  PatchTeamRoles2
> = z.object({
  accessGroupId: z.string(),
});

export function patchTeamRoles2ToJSON(
  patchTeamRoles2: PatchTeamRoles2,
): string {
  return JSON.stringify(PatchTeamRoles2$outboundSchema.parse(patchTeamRoles2));
}

/** @internal */
export const PatchTeamRoles1$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamRoles1
> = z.nativeEnum(PatchTeamRoles1);

/** @internal */
export type PatchTeamRoles$Outbound = PatchTeamRoles2$Outbound | string;

/** @internal */
export const PatchTeamRoles$outboundSchema: z.ZodType<
  PatchTeamRoles$Outbound,
  z.ZodTypeDef,
  PatchTeamRoles
> = smartUnion([
  z.lazy(() => PatchTeamRoles2$outboundSchema),
  PatchTeamRoles1$outboundSchema,
]);

export function patchTeamRolesToJSON(patchTeamRoles: PatchTeamRoles): string {
  return JSON.stringify(PatchTeamRoles$outboundSchema.parse(patchTeamRoles));
}

/** @internal */
export type PatchTeamSaml$Outbound = {
  enforced?: boolean | undefined;
  roles?: { [k: string]: PatchTeamRoles2$Outbound | string } | undefined;
};

/** @internal */
export const PatchTeamSaml$outboundSchema: z.ZodType<
  PatchTeamSaml$Outbound,
  z.ZodTypeDef,
  PatchTeamSaml
> = z.object({
  enforced: z.boolean().optional(),
  roles: z.record(
    smartUnion([
      z.lazy(() => PatchTeamRoles2$outboundSchema),
      PatchTeamRoles1$outboundSchema,
    ]),
  ).optional(),
});

export function patchTeamSamlToJSON(patchTeamSaml: PatchTeamSaml): string {
  return JSON.stringify(PatchTeamSaml$outboundSchema.parse(patchTeamSaml));
}

/** @internal */
export type PatchTeamRemoteCaching$Outbound = {
  enabled?: boolean | undefined;
};

/** @internal */
export const PatchTeamRemoteCaching$outboundSchema: z.ZodType<
  PatchTeamRemoteCaching$Outbound,
  z.ZodTypeDef,
  PatchTeamRemoteCaching
> = z.object({
  enabled: z.boolean().optional(),
});

export function patchTeamRemoteCachingToJSON(
  patchTeamRemoteCaching: PatchTeamRemoteCaching,
): string {
  return JSON.stringify(
    PatchTeamRemoteCaching$outboundSchema.parse(patchTeamRemoteCaching),
  );
}

/** @internal */
export const PatchTeamDpAccessRequestsMode$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamDpAccessRequestsMode
> = z.nativeEnum(PatchTeamDpAccessRequestsMode);

/** @internal */
export const PatchTeamDeploymentType$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamDeploymentType
> = z.nativeEnum(PatchTeamDeploymentType);

/** @internal */
export type PatchTeamPasswordProtection$Outbound = {
  deploymentType: string;
  password?: string | null | undefined;
};

/** @internal */
export const PatchTeamPasswordProtection$outboundSchema: z.ZodType<
  PatchTeamPasswordProtection$Outbound,
  z.ZodTypeDef,
  PatchTeamPasswordProtection
> = z.object({
  deploymentType: PatchTeamDeploymentType$outboundSchema,
  password: z.nullable(z.string()).optional(),
});

export function patchTeamPasswordProtectionToJSON(
  patchTeamPasswordProtection: PatchTeamPasswordProtection,
): string {
  return JSON.stringify(
    PatchTeamPasswordProtection$outboundSchema.parse(
      patchTeamPasswordProtection,
    ),
  );
}

/** @internal */
export const PatchTeamTeamsDeploymentType$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamTeamsDeploymentType
> = z.nativeEnum(PatchTeamTeamsDeploymentType);

/** @internal */
export type PatchTeamSsoProtection$Outbound = {
  deploymentType: string;
};

/** @internal */
export const PatchTeamSsoProtection$outboundSchema: z.ZodType<
  PatchTeamSsoProtection$Outbound,
  z.ZodTypeDef,
  PatchTeamSsoProtection
> = z.object({
  deploymentType: PatchTeamTeamsDeploymentType$outboundSchema.default(
    "preview",
  ),
});

export function patchTeamSsoProtectionToJSON(
  patchTeamSsoProtection: PatchTeamSsoProtection,
): string {
  return JSON.stringify(
    PatchTeamSsoProtection$outboundSchema.parse(patchTeamSsoProtection),
  );
}

/** @internal */
export type PatchTeamDefaultDeploymentProtection$Outbound = {
  passwordProtection?: PatchTeamPasswordProtection$Outbound | null | undefined;
  ssoProtection?: PatchTeamSsoProtection$Outbound | null | undefined;
};

/** @internal */
export const PatchTeamDefaultDeploymentProtection$outboundSchema: z.ZodType<
  PatchTeamDefaultDeploymentProtection$Outbound,
  z.ZodTypeDef,
  PatchTeamDefaultDeploymentProtection
> = z.object({
  passwordProtection: z.nullable(
    z.lazy(() => PatchTeamPasswordProtection$outboundSchema),
  ).optional(),
  ssoProtection: z.nullable(z.lazy(() => PatchTeamSsoProtection$outboundSchema))
    .optional(),
});

export function patchTeamDefaultDeploymentProtectionToJSON(
  patchTeamDefaultDeploymentProtection: PatchTeamDefaultDeploymentProtection,
): string {
  return JSON.stringify(
    PatchTeamDefaultDeploymentProtection$outboundSchema.parse(
      patchTeamDefaultDeploymentProtection,
    ),
  );
}

/** @internal */
export const PatchTeamTeamsRequestDeploymentType$outboundSchema:
  z.ZodNativeEnum<typeof PatchTeamTeamsRequestDeploymentType> = z.nativeEnum(
    PatchTeamTeamsRequestDeploymentType,
  );

/** @internal */
export type PatchTeamDefaultPassport$Outbound = {
  connectorId: string;
  deploymentType: string;
};

/** @internal */
export const PatchTeamDefaultPassport$outboundSchema: z.ZodType<
  PatchTeamDefaultPassport$Outbound,
  z.ZodTypeDef,
  PatchTeamDefaultPassport
> = z.object({
  connectorId: z.string(),
  deploymentType: PatchTeamTeamsRequestDeploymentType$outboundSchema,
});

export function patchTeamDefaultPassportToJSON(
  patchTeamDefaultPassport: PatchTeamDefaultPassport,
): string {
  return JSON.stringify(
    PatchTeamDefaultPassport$outboundSchema.parse(patchTeamDefaultPassport),
  );
}

/** @internal */
export const PatchTeamExpiration$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamExpiration
> = z.nativeEnum(PatchTeamExpiration);

/** @internal */
export const ExpirationProduction$outboundSchema: z.ZodNativeEnum<
  typeof ExpirationProduction
> = z.nativeEnum(ExpirationProduction);

/** @internal */
export const ExpirationCanceled$outboundSchema: z.ZodNativeEnum<
  typeof ExpirationCanceled
> = z.nativeEnum(ExpirationCanceled);

/** @internal */
export const ExpirationErrored$outboundSchema: z.ZodNativeEnum<
  typeof ExpirationErrored
> = z.nativeEnum(ExpirationErrored);

/** @internal */
export type PatchTeamDefaultExpirationSettings$Outbound = {
  expiration?: string | undefined;
  expirationProduction?: string | undefined;
  expirationCanceled?: string | undefined;
  expirationErrored?: string | undefined;
};

/** @internal */
export const PatchTeamDefaultExpirationSettings$outboundSchema: z.ZodType<
  PatchTeamDefaultExpirationSettings$Outbound,
  z.ZodTypeDef,
  PatchTeamDefaultExpirationSettings
> = z.object({
  expiration: PatchTeamExpiration$outboundSchema.optional(),
  expirationProduction: ExpirationProduction$outboundSchema.optional(),
  expirationCanceled: ExpirationCanceled$outboundSchema.optional(),
  expirationErrored: ExpirationErrored$outboundSchema.optional(),
});

export function patchTeamDefaultExpirationSettingsToJSON(
  patchTeamDefaultExpirationSettings: PatchTeamDefaultExpirationSettings,
): string {
  return JSON.stringify(
    PatchTeamDefaultExpirationSettings$outboundSchema.parse(
      patchTeamDefaultExpirationSettings,
    ),
  );
}

/** @internal */
export type PatchTeamEnvironments2$Outbound = {
  type: "custom";
  environmentId: string;
};

/** @internal */
export const PatchTeamEnvironments2$outboundSchema: z.ZodType<
  PatchTeamEnvironments2$Outbound,
  z.ZodTypeDef,
  PatchTeamEnvironments2
> = z.object({
  type: z.literal("custom"),
  environmentId: z.string(),
});

export function patchTeamEnvironments2ToJSON(
  patchTeamEnvironments2: PatchTeamEnvironments2,
): string {
  return JSON.stringify(
    PatchTeamEnvironments2$outboundSchema.parse(patchTeamEnvironments2),
  );
}

/** @internal */
export const PatchTeamEnvironmentsTarget$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamEnvironmentsTarget
> = z.nativeEnum(PatchTeamEnvironmentsTarget);

/** @internal */
export type PatchTeamEnvironments1$Outbound = {
  type: "system";
  target: string;
};

/** @internal */
export const PatchTeamEnvironments1$outboundSchema: z.ZodType<
  PatchTeamEnvironments1$Outbound,
  z.ZodTypeDef,
  PatchTeamEnvironments1
> = z.object({
  type: z.literal("system"),
  target: PatchTeamEnvironmentsTarget$outboundSchema,
});

export function patchTeamEnvironments1ToJSON(
  patchTeamEnvironments1: PatchTeamEnvironments1,
): string {
  return JSON.stringify(
    PatchTeamEnvironments1$outboundSchema.parse(patchTeamEnvironments1),
  );
}

/** @internal */
export type PatchTeamGitSourcesEnvironments$Outbound =
  | PatchTeamEnvironments1$Outbound
  | PatchTeamEnvironments2$Outbound;

/** @internal */
export const PatchTeamGitSourcesEnvironments$outboundSchema: z.ZodType<
  PatchTeamGitSourcesEnvironments$Outbound,
  z.ZodTypeDef,
  PatchTeamGitSourcesEnvironments
> = z.union([
  z.lazy(() => PatchTeamEnvironments1$outboundSchema),
  z.lazy(() => PatchTeamEnvironments2$outboundSchema),
]);

export function patchTeamGitSourcesEnvironmentsToJSON(
  patchTeamGitSourcesEnvironments: PatchTeamGitSourcesEnvironments,
): string {
  return JSON.stringify(
    PatchTeamGitSourcesEnvironments$outboundSchema.parse(
      patchTeamGitSourcesEnvironments,
    ),
  );
}

/** @internal */
export type PatchTeamSources2$Outbound = {
  provider: "gitlab";
  namespace: string;
  project?: string | undefined;
};

/** @internal */
export const PatchTeamSources2$outboundSchema: z.ZodType<
  PatchTeamSources2$Outbound,
  z.ZodTypeDef,
  PatchTeamSources2
> = z.object({
  provider: z.literal("gitlab"),
  namespace: z.string(),
  project: z.string().optional(),
});

export function patchTeamSources2ToJSON(
  patchTeamSources2: PatchTeamSources2,
): string {
  return JSON.stringify(
    PatchTeamSources2$outboundSchema.parse(patchTeamSources2),
  );
}

/** @internal */
export const PatchTeamSourcesProvider$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamSourcesProvider
> = z.nativeEnum(PatchTeamSourcesProvider);

/** @internal */
export type PatchTeamSources1$Outbound = {
  provider: string;
  org: string;
  repo?: string | undefined;
};

/** @internal */
export const PatchTeamSources1$outboundSchema: z.ZodType<
  PatchTeamSources1$Outbound,
  z.ZodTypeDef,
  PatchTeamSources1
> = z.object({
  provider: PatchTeamSourcesProvider$outboundSchema,
  org: z.string(),
  repo: z.string().optional(),
});

export function patchTeamSources1ToJSON(
  patchTeamSources1: PatchTeamSources1,
): string {
  return JSON.stringify(
    PatchTeamSources1$outboundSchema.parse(patchTeamSources1),
  );
}

/** @internal */
export type PatchTeamGitSourcesSources$Outbound =
  | (PatchTeamSources1$Outbound & { provider: "github" })
  | (PatchTeamSources1$Outbound & { provider: "bitbucket" })
  | PatchTeamSources2$Outbound;

/** @internal */
export const PatchTeamGitSourcesSources$outboundSchema: z.ZodType<
  PatchTeamGitSourcesSources$Outbound,
  z.ZodTypeDef,
  PatchTeamGitSourcesSources
> = z.union([
  z.lazy(() => PatchTeamSources1$outboundSchema).and(
    z.object({ provider: z.literal("github") }),
  ),
  z.lazy(() => PatchTeamSources1$outboundSchema).and(
    z.object({ provider: z.literal("bitbucket") }),
  ),
  z.lazy(() => PatchTeamSources2$outboundSchema),
]);

export function patchTeamGitSourcesSourcesToJSON(
  patchTeamGitSourcesSources: PatchTeamGitSourcesSources,
): string {
  return JSON.stringify(
    PatchTeamGitSourcesSources$outboundSchema.parse(patchTeamGitSourcesSources),
  );
}

/** @internal */
export type PatchTeamGitSources1$Outbound = {
  enabled: boolean;
  environments: Array<
    PatchTeamEnvironments1$Outbound | PatchTeamEnvironments2$Outbound
  >;
  sources: Array<
    | (PatchTeamSources1$Outbound & { provider: "github" })
    | (PatchTeamSources1$Outbound & { provider: "bitbucket" })
    | PatchTeamSources2$Outbound
  >;
};

/** @internal */
export const PatchTeamGitSources1$outboundSchema: z.ZodType<
  PatchTeamGitSources1$Outbound,
  z.ZodTypeDef,
  PatchTeamGitSources1
> = z.object({
  enabled: z.boolean(),
  environments: z.array(
    z.union([
      z.lazy(() => PatchTeamEnvironments1$outboundSchema),
      z.lazy(() => PatchTeamEnvironments2$outboundSchema),
    ]),
  ),
  sources: z.array(
    z.union([
      z.lazy(() => PatchTeamSources1$outboundSchema).and(
        z.object({ provider: z.literal("github") }),
      ),
      z.lazy(() => PatchTeamSources1$outboundSchema).and(
        z.object({ provider: z.literal("bitbucket") }),
      ),
      z.lazy(() => PatchTeamSources2$outboundSchema),
    ]),
  ),
});

export function patchTeamGitSources1ToJSON(
  patchTeamGitSources1: PatchTeamGitSources1,
): string {
  return JSON.stringify(
    PatchTeamGitSources1$outboundSchema.parse(patchTeamGitSources1),
  );
}

/** @internal */
export type PatchTeamDeploymentPolicyGitSources$Outbound =
  | Array<PatchTeamGitSources1$Outbound>
  | string;

/** @internal */
export const PatchTeamDeploymentPolicyGitSources$outboundSchema: z.ZodType<
  PatchTeamDeploymentPolicyGitSources$Outbound,
  z.ZodTypeDef,
  PatchTeamDeploymentPolicyGitSources
> = smartUnion([
  z.array(z.lazy(() => PatchTeamGitSources1$outboundSchema)),
  z.string(),
]);

export function patchTeamDeploymentPolicyGitSourcesToJSON(
  patchTeamDeploymentPolicyGitSources: PatchTeamDeploymentPolicyGitSources,
): string {
  return JSON.stringify(
    PatchTeamDeploymentPolicyGitSources$outboundSchema.parse(
      patchTeamDeploymentPolicyGitSources,
    ),
  );
}

/** @internal */
export type PatchTeamEnvironmentsTeams2$Outbound = {
  type: "custom";
  environmentId: string;
};

/** @internal */
export const PatchTeamEnvironmentsTeams2$outboundSchema: z.ZodType<
  PatchTeamEnvironmentsTeams2$Outbound,
  z.ZodTypeDef,
  PatchTeamEnvironmentsTeams2
> = z.object({
  type: z.literal("custom"),
  environmentId: z.string(),
});

export function patchTeamEnvironmentsTeams2ToJSON(
  patchTeamEnvironmentsTeams2: PatchTeamEnvironmentsTeams2,
): string {
  return JSON.stringify(
    PatchTeamEnvironmentsTeams2$outboundSchema.parse(
      patchTeamEnvironmentsTeams2,
    ),
  );
}

/** @internal */
export const PatchTeamEnvironmentsTeamsTarget$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamEnvironmentsTeamsTarget
> = z.nativeEnum(PatchTeamEnvironmentsTeamsTarget);

/** @internal */
export type PatchTeamEnvironmentsTeams1$Outbound = {
  type: "system";
  target: string;
};

/** @internal */
export const PatchTeamEnvironmentsTeams1$outboundSchema: z.ZodType<
  PatchTeamEnvironmentsTeams1$Outbound,
  z.ZodTypeDef,
  PatchTeamEnvironmentsTeams1
> = z.object({
  type: z.literal("system"),
  target: PatchTeamEnvironmentsTeamsTarget$outboundSchema,
});

export function patchTeamEnvironmentsTeams1ToJSON(
  patchTeamEnvironmentsTeams1: PatchTeamEnvironmentsTeams1,
): string {
  return JSON.stringify(
    PatchTeamEnvironmentsTeams1$outboundSchema.parse(
      patchTeamEnvironmentsTeams1,
    ),
  );
}

/** @internal */
export type PatchTeamDeploymentSourcesEnvironments$Outbound =
  | PatchTeamEnvironmentsTeams1$Outbound
  | PatchTeamEnvironmentsTeams2$Outbound;

/** @internal */
export const PatchTeamDeploymentSourcesEnvironments$outboundSchema: z.ZodType<
  PatchTeamDeploymentSourcesEnvironments$Outbound,
  z.ZodTypeDef,
  PatchTeamDeploymentSourcesEnvironments
> = z.union([
  z.lazy(() => PatchTeamEnvironmentsTeams1$outboundSchema),
  z.lazy(() => PatchTeamEnvironmentsTeams2$outboundSchema),
]);

export function patchTeamDeploymentSourcesEnvironmentsToJSON(
  patchTeamDeploymentSourcesEnvironments:
    PatchTeamDeploymentSourcesEnvironments,
): string {
  return JSON.stringify(
    PatchTeamDeploymentSourcesEnvironments$outboundSchema.parse(
      patchTeamDeploymentSourcesEnvironments,
    ),
  );
}

/** @internal */
export const PatchTeamDeploymentSourcesSources$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamDeploymentSourcesSources
> = z.nativeEnum(PatchTeamDeploymentSourcesSources);

/** @internal */
export type PatchTeamDeploymentSources1$Outbound = {
  enabled: boolean;
  environments: Array<
    PatchTeamEnvironmentsTeams1$Outbound | PatchTeamEnvironmentsTeams2$Outbound
  >;
  sources: Array<string>;
};

/** @internal */
export const PatchTeamDeploymentSources1$outboundSchema: z.ZodType<
  PatchTeamDeploymentSources1$Outbound,
  z.ZodTypeDef,
  PatchTeamDeploymentSources1
> = z.object({
  enabled: z.boolean(),
  environments: z.array(
    z.union([
      z.lazy(() => PatchTeamEnvironmentsTeams1$outboundSchema),
      z.lazy(() => PatchTeamEnvironmentsTeams2$outboundSchema),
    ]),
  ),
  sources: z.array(PatchTeamDeploymentSourcesSources$outboundSchema),
});

export function patchTeamDeploymentSources1ToJSON(
  patchTeamDeploymentSources1: PatchTeamDeploymentSources1,
): string {
  return JSON.stringify(
    PatchTeamDeploymentSources1$outboundSchema.parse(
      patchTeamDeploymentSources1,
    ),
  );
}

/** @internal */
export type PatchTeamDeploymentPolicyDeploymentSources$Outbound =
  | Array<PatchTeamDeploymentSources1$Outbound>
  | string;

/** @internal */
export const PatchTeamDeploymentPolicyDeploymentSources$outboundSchema:
  z.ZodType<
    PatchTeamDeploymentPolicyDeploymentSources$Outbound,
    z.ZodTypeDef,
    PatchTeamDeploymentPolicyDeploymentSources
  > = smartUnion([
    z.array(z.lazy(() => PatchTeamDeploymentSources1$outboundSchema)),
    z.string(),
  ]);

export function patchTeamDeploymentPolicyDeploymentSourcesToJSON(
  patchTeamDeploymentPolicyDeploymentSources:
    PatchTeamDeploymentPolicyDeploymentSources,
): string {
  return JSON.stringify(
    PatchTeamDeploymentPolicyDeploymentSources$outboundSchema.parse(
      patchTeamDeploymentPolicyDeploymentSources,
    ),
  );
}

/** @internal */
export type PatchTeamDeploymentPolicy1$Outbound = {
  gitSources?: Array<PatchTeamGitSources1$Outbound> | string | undefined;
  deploymentSources?:
    | Array<PatchTeamDeploymentSources1$Outbound>
    | string
    | undefined;
};

/** @internal */
export const PatchTeamDeploymentPolicy1$outboundSchema: z.ZodType<
  PatchTeamDeploymentPolicy1$Outbound,
  z.ZodTypeDef,
  PatchTeamDeploymentPolicy1
> = z.object({
  gitSources: smartUnion([
    z.array(z.lazy(() => PatchTeamGitSources1$outboundSchema)),
    z.string(),
  ]).optional(),
  deploymentSources: smartUnion([
    z.array(z.lazy(() => PatchTeamDeploymentSources1$outboundSchema)),
    z.string(),
  ]).optional(),
});

export function patchTeamDeploymentPolicy1ToJSON(
  patchTeamDeploymentPolicy1: PatchTeamDeploymentPolicy1,
): string {
  return JSON.stringify(
    PatchTeamDeploymentPolicy1$outboundSchema.parse(patchTeamDeploymentPolicy1),
  );
}

/** @internal */
export type PatchTeamDeploymentPolicy$Outbound =
  | PatchTeamDeploymentPolicy1$Outbound
  | string;

/** @internal */
export const PatchTeamDeploymentPolicy$outboundSchema: z.ZodType<
  PatchTeamDeploymentPolicy$Outbound,
  z.ZodTypeDef,
  PatchTeamDeploymentPolicy
> = smartUnion([
  z.lazy(() => PatchTeamDeploymentPolicy1$outboundSchema),
  z.string(),
]);

export function patchTeamDeploymentPolicyToJSON(
  patchTeamDeploymentPolicy: PatchTeamDeploymentPolicy,
): string {
  return JSON.stringify(
    PatchTeamDeploymentPolicy$outboundSchema.parse(patchTeamDeploymentPolicy),
  );
}

/** @internal */
export type PatchTeamStrictDeploymentProtectionSettings$Outbound = {
  enabled: boolean;
};

/** @internal */
export const PatchTeamStrictDeploymentProtectionSettings$outboundSchema:
  z.ZodType<
    PatchTeamStrictDeploymentProtectionSettings$Outbound,
    z.ZodTypeDef,
    PatchTeamStrictDeploymentProtectionSettings
  > = z.object({
    enabled: z.boolean(),
  });

export function patchTeamStrictDeploymentProtectionSettingsToJSON(
  patchTeamStrictDeploymentProtectionSettings:
    PatchTeamStrictDeploymentProtectionSettings,
): string {
  return JSON.stringify(
    PatchTeamStrictDeploymentProtectionSettings$outboundSchema.parse(
      patchTeamStrictDeploymentProtectionSettings,
    ),
  );
}

/** @internal */
export type PatchTeamStrictShareableLinks$Outbound = {
  enabled: boolean;
};

/** @internal */
export const PatchTeamStrictShareableLinks$outboundSchema: z.ZodType<
  PatchTeamStrictShareableLinks$Outbound,
  z.ZodTypeDef,
  PatchTeamStrictShareableLinks
> = z.object({
  enabled: z.boolean(),
});

export function patchTeamStrictShareableLinksToJSON(
  patchTeamStrictShareableLinks: PatchTeamStrictShareableLinks,
): string {
  return JSON.stringify(
    PatchTeamStrictShareableLinks$outboundSchema.parse(
      patchTeamStrictShareableLinks,
    ),
  );
}

/** @internal */
export const NsnbConfigPreference$outboundSchema: z.ZodNativeEnum<
  typeof NsnbConfigPreference
> = z.nativeEnum(NsnbConfigPreference);

/** @internal */
export type NsnbConfig1$Outbound = {
  preference: string;
};

/** @internal */
export const NsnbConfig1$outboundSchema: z.ZodType<
  NsnbConfig1$Outbound,
  z.ZodTypeDef,
  NsnbConfig1
> = z.object({
  preference: NsnbConfigPreference$outboundSchema,
});

export function nsnbConfig1ToJSON(nsnbConfig1: NsnbConfig1): string {
  return JSON.stringify(NsnbConfig1$outboundSchema.parse(nsnbConfig1));
}

/** @internal */
export type PatchTeamNsnbConfig$Outbound = NsnbConfig1$Outbound | string;

/** @internal */
export const PatchTeamNsnbConfig$outboundSchema: z.ZodType<
  PatchTeamNsnbConfig$Outbound,
  z.ZodTypeDef,
  PatchTeamNsnbConfig
> = smartUnion([z.lazy(() => NsnbConfig1$outboundSchema), z.string()]);

export function patchTeamNsnbConfigToJSON(
  patchTeamNsnbConfig: PatchTeamNsnbConfig,
): string {
  return JSON.stringify(
    PatchTeamNsnbConfig$outboundSchema.parse(patchTeamNsnbConfig),
  );
}

/** @internal */
export type DefaultProjectJobsLint$Outbound = {
  targets: Array<string>;
};

/** @internal */
export const DefaultProjectJobsLint$outboundSchema: z.ZodType<
  DefaultProjectJobsLint$Outbound,
  z.ZodTypeDef,
  DefaultProjectJobsLint
> = z.object({
  targets: z.array(z.string()),
});

export function defaultProjectJobsLintToJSON(
  defaultProjectJobsLint: DefaultProjectJobsLint,
): string {
  return JSON.stringify(
    DefaultProjectJobsLint$outboundSchema.parse(defaultProjectJobsLint),
  );
}

/** @internal */
export type DefaultProjectJobsTypecheck$Outbound = {
  targets: Array<string>;
};

/** @internal */
export const DefaultProjectJobsTypecheck$outboundSchema: z.ZodType<
  DefaultProjectJobsTypecheck$Outbound,
  z.ZodTypeDef,
  DefaultProjectJobsTypecheck
> = z.object({
  targets: z.array(z.string()),
});

export function defaultProjectJobsTypecheckToJSON(
  defaultProjectJobsTypecheck: DefaultProjectJobsTypecheck,
): string {
  return JSON.stringify(
    DefaultProjectJobsTypecheck$outboundSchema.parse(
      defaultProjectJobsTypecheck,
    ),
  );
}

/** @internal */
export type DefaultProjectJobs1$Outbound = {
  lint?: DefaultProjectJobsLint$Outbound | undefined;
  typecheck?: DefaultProjectJobsTypecheck$Outbound | undefined;
};

/** @internal */
export const DefaultProjectJobs1$outboundSchema: z.ZodType<
  DefaultProjectJobs1$Outbound,
  z.ZodTypeDef,
  DefaultProjectJobs1
> = z.object({
  lint: z.lazy(() => DefaultProjectJobsLint$outboundSchema).optional(),
  typecheck: z.lazy(() => DefaultProjectJobsTypecheck$outboundSchema)
    .optional(),
});

export function defaultProjectJobs1ToJSON(
  defaultProjectJobs1: DefaultProjectJobs1,
): string {
  return JSON.stringify(
    DefaultProjectJobs1$outboundSchema.parse(defaultProjectJobs1),
  );
}

/** @internal */
export type PatchTeamDefaultProjectJobs$Outbound =
  | DefaultProjectJobs1$Outbound
  | string;

/** @internal */
export const PatchTeamDefaultProjectJobs$outboundSchema: z.ZodType<
  PatchTeamDefaultProjectJobs$Outbound,
  z.ZodTypeDef,
  PatchTeamDefaultProjectJobs
> = smartUnion([z.lazy(() => DefaultProjectJobs1$outboundSchema), z.string()]);

export function patchTeamDefaultProjectJobsToJSON(
  patchTeamDefaultProjectJobs: PatchTeamDefaultProjectJobs,
): string {
  return JSON.stringify(
    PatchTeamDefaultProjectJobs$outboundSchema.parse(
      patchTeamDefaultProjectJobs,
    ),
  );
}

/** @internal */
export const PatchTeamDefault$outboundSchema: z.ZodNativeEnum<
  typeof PatchTeamDefault
> = z.nativeEnum(PatchTeamDefault);

/** @internal */
export type PatchTeamBuildMachine$Outbound = {
  default?: string | undefined;
};

/** @internal */
export const PatchTeamBuildMachine$outboundSchema: z.ZodType<
  PatchTeamBuildMachine$Outbound,
  z.ZodTypeDef,
  PatchTeamBuildMachine
> = z.object({
  default: PatchTeamDefault$outboundSchema.optional(),
});

export function patchTeamBuildMachineToJSON(
  patchTeamBuildMachine: PatchTeamBuildMachine,
): string {
  return JSON.stringify(
    PatchTeamBuildMachine$outboundSchema.parse(patchTeamBuildMachine),
  );
}

/** @internal */
export type PatchTeamResourceConfig$Outbound = {
  buildMachine?: PatchTeamBuildMachine$Outbound | undefined;
};

/** @internal */
export const PatchTeamResourceConfig$outboundSchema: z.ZodType<
  PatchTeamResourceConfig$Outbound,
  z.ZodTypeDef,
  PatchTeamResourceConfig
> = z.object({
  buildMachine: z.lazy(() => PatchTeamBuildMachine$outboundSchema).optional(),
});

export function patchTeamResourceConfigToJSON(
  patchTeamResourceConfig: PatchTeamResourceConfig,
): string {
  return JSON.stringify(
    PatchTeamResourceConfig$outboundSchema.parse(patchTeamResourceConfig),
  );
}

/** @internal */
export type PatchTeamRequestBody$Outbound = {
  avatar?: string | undefined;
  description?: string | undefined;
  emailDomain?: string | null | undefined;
  name?: string | undefined;
  previewDeploymentSuffix?: string | null | undefined;
  regenerateInviteCode?: boolean | undefined;
  saml?: PatchTeamSaml$Outbound | undefined;
  slug?: string | undefined;
  enablePreviewFeedback?: string | undefined;
  enableProductionFeedback?: string | undefined;
  sensitiveEnvironmentVariablePolicy?: string | undefined;
  remoteCaching?: PatchTeamRemoteCaching$Outbound | undefined;
  hideIpAddresses?: boolean | undefined;
  hideIpAddressesInLogDrains?: boolean | undefined;
  dpAccessRequestsMode?: string | undefined;
  requireVerifiedCommits?: boolean | undefined;
  disableRepositoryDispatchEvents?: boolean | undefined;
  defaultDeploymentProtection?:
    | PatchTeamDefaultDeploymentProtection$Outbound
    | undefined;
  defaultPassport?: PatchTeamDefaultPassport$Outbound | null | undefined;
  defaultExpirationSettings?:
    | PatchTeamDefaultExpirationSettings$Outbound
    | undefined;
  deploymentPolicy?: PatchTeamDeploymentPolicy1$Outbound | string | undefined;
  strictDeploymentProtectionSettings?:
    | PatchTeamStrictDeploymentProtectionSettings$Outbound
    | undefined;
  strictShareableLinks?: PatchTeamStrictShareableLinks$Outbound | undefined;
  nsnbConfig?: NsnbConfig1$Outbound | string | undefined;
  defaultProjectJobs?: DefaultProjectJobs1$Outbound | string | undefined;
  resourceConfig?: PatchTeamResourceConfig$Outbound | undefined;
};

/** @internal */
export const PatchTeamRequestBody$outboundSchema: z.ZodType<
  PatchTeamRequestBody$Outbound,
  z.ZodTypeDef,
  PatchTeamRequestBody
> = z.object({
  avatar: z.string().optional(),
  description: z.string().optional(),
  emailDomain: z.nullable(z.string()).optional(),
  name: z.string().optional(),
  previewDeploymentSuffix: z.nullable(z.string()).optional(),
  regenerateInviteCode: z.boolean().optional(),
  saml: z.lazy(() => PatchTeamSaml$outboundSchema).optional(),
  slug: z.string().optional(),
  enablePreviewFeedback: z.string().optional(),
  enableProductionFeedback: z.string().optional(),
  sensitiveEnvironmentVariablePolicy: z.string().optional(),
  remoteCaching: z.lazy(() => PatchTeamRemoteCaching$outboundSchema).optional(),
  hideIpAddresses: z.boolean().optional(),
  hideIpAddressesInLogDrains: z.boolean().optional(),
  dpAccessRequestsMode: PatchTeamDpAccessRequestsMode$outboundSchema.optional(),
  requireVerifiedCommits: z.boolean().optional(),
  disableRepositoryDispatchEvents: z.boolean().optional(),
  defaultDeploymentProtection: z.lazy(() =>
    PatchTeamDefaultDeploymentProtection$outboundSchema
  ).optional(),
  defaultPassport: z.nullable(
    z.lazy(() => PatchTeamDefaultPassport$outboundSchema),
  ).optional(),
  defaultExpirationSettings: z.lazy(() =>
    PatchTeamDefaultExpirationSettings$outboundSchema
  ).optional(),
  deploymentPolicy: smartUnion([
    z.lazy(() => PatchTeamDeploymentPolicy1$outboundSchema),
    z.string(),
  ]).optional(),
  strictDeploymentProtectionSettings: z.lazy(() =>
    PatchTeamStrictDeploymentProtectionSettings$outboundSchema
  ).optional(),
  strictShareableLinks: z.lazy(() =>
    PatchTeamStrictShareableLinks$outboundSchema
  ).optional(),
  nsnbConfig: smartUnion([z.lazy(() => NsnbConfig1$outboundSchema), z.string()])
    .optional(),
  defaultProjectJobs: smartUnion([
    z.lazy(() => DefaultProjectJobs1$outboundSchema),
    z.string(),
  ]).optional(),
  resourceConfig: z.lazy(() => PatchTeamResourceConfig$outboundSchema)
    .optional(),
});

export function patchTeamRequestBodyToJSON(
  patchTeamRequestBody: PatchTeamRequestBody,
): string {
  return JSON.stringify(
    PatchTeamRequestBody$outboundSchema.parse(patchTeamRequestBody),
  );
}

/** @internal */
export type PatchTeamRequest$Outbound = {
  teamId: string;
  slug?: string | undefined;
  RequestBody: PatchTeamRequestBody$Outbound;
};

/** @internal */
export const PatchTeamRequest$outboundSchema: z.ZodType<
  PatchTeamRequest$Outbound,
  z.ZodTypeDef,
  PatchTeamRequest
> = z.object({
  teamId: z.string(),
  slug: z.string().optional(),
  requestBody: z.lazy(() => PatchTeamRequestBody$outboundSchema),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function patchTeamRequestToJSON(
  patchTeamRequest: PatchTeamRequest,
): string {
  return JSON.stringify(
    PatchTeamRequest$outboundSchema.parse(patchTeamRequest),
  );
}
