// This file is auto-generated by @hey-api/openapi-ts

import * as z from 'zod';

export const zAuthAuthenticatePayload = z.object({
  Password: z.string(),
  Username: z.string(),
});

export const zAuthAuthenticateResponse = z.object({
  jwt: z.string().optional(),
});

export const zAuthOauthPayload = z.object({
  Code: z.string().optional(),
});

export const zBackupBackupPayload = z.object({
  Password: z.string().optional(),
});

export const zBackupRestorePayload = z.object({
  FileContent: z
    .array(
      z
        .int()
        .min(-2147483648, {
          error: 'Invalid value: Expected int32 to be >= -2147483648',
        })
        .max(2147483647, {
          error: 'Invalid value: Expected int32 to be <= 2147483647',
        })
    )
    .optional(),
  FileName: z.string().optional(),
  Password: z.string().optional(),
});

export const zBuildBuildInfo = z.object({
  BuildNumber: z.string().optional(),
  GitCommit: z.string().optional(),
  GoVersion: z.string().optional(),
  ImageTag: z.string().optional(),
  NodejsVersion: z.string().optional(),
  PnpmVersion: z.string().optional(),
  WebpackVersion: z.string().optional(),
});

export const zBuildDependenciesInfo = z.object({
  ComposeVersion: z.string().optional(),
  DockerVersion: z.string().optional(),
  HelmVersion: z.string().optional(),
  KubectlVersion: z.string().optional(),
});

export const zBuildRuntimeInfo = z.object({
  Env: z.array(z.string()).optional(),
});

export const zContainersContainerGpusResponse = z.object({
  gpus: z.string().optional(),
});

export const zCustomtemplatesFileResponse = z.object({
  FileContent: z.string().optional(),
});

export const zDockerImagesCounters = z.object({
  size: z.int().optional(),
  total: z.int().optional(),
});

export const zEdgegroupsEdgeGroupCreatePayload = z.object({
  Dynamic: z.boolean().optional(),
  Endpoints: z.array(z.int()).optional(),
  Name: z.string().optional(),
  PartialMatch: z.boolean().optional(),
  TagIDs: z.array(z.int()).optional(),
});

export const zEdgegroupsEdgeGroupUpdatePayload = z.object({
  Dynamic: z.boolean().optional(),
  Endpoints: z.array(z.int()).optional(),
  Name: z.string().optional(),
  PartialMatch: z.boolean().optional(),
  TagIDs: z.array(z.int()).optional(),
});

export const zEdgejobsEdgeJobCreateFromFileContentPayload = z.object({
  CronExpression: z.string().optional(),
  EdgeGroups: z.array(z.int()).optional(),
  Endpoints: z.array(z.int()).optional(),
  FileContent: z.string().optional(),
  Name: z.string().optional(),
  Recurring: z.boolean().optional(),
});

export const zEdgejobsEdgeJobFileResponse = z.object({
  FileContent: z.string().optional(),
});

export const zEdgejobsEdgeJobUpdatePayload = z.object({
  CronExpression: z.string().optional(),
  EdgeGroups: z.array(z.int()).optional(),
  Endpoints: z.array(z.int()).optional(),
  FileContent: z.string().optional(),
  Name: z.string().optional(),
  Recurring: z.boolean().optional(),
});

export const zEdgejobsFileResponse = z.object({
  FileContent: z.string().optional(),
});

export const zEdgestacksEdgeStackFromGitRepositoryPayload = z.object({
  DeploymentType: z
    .union([z.literal(0), z.literal(1), z.literal(2)])
    .optional(),
  EdgeGroups: z.array(z.int()),
  FilePathInRepository: z.string().optional().default('docker-compose.yml'),
  Name: z.string(),
  Registries: z.array(z.int()).optional(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  SourceID: z.int().optional(),
  TLSSkipVerify: z.boolean().optional(),
  UseManifestNamespaces: z.boolean().optional(),
});

export const zEdgestacksEdgeStackFromStringPayload = z.object({
  DeploymentType: z
    .union([z.literal(0), z.literal(1), z.literal(2)])
    .optional(),
  EdgeGroups: z.array(z.int()).optional(),
  Name: z.string(),
  Registries: z.array(z.int()).optional(),
  StackFileContent: z.string(),
  UseManifestNamespaces: z.boolean().optional(),
});

export const zEdgestacksStackFileResponse = z.object({
  StackFileContent: z.string().optional(),
});

export const zEndpointgroupsEndpointGroupTypeInfo = z.object({
  Docker: z.int(),
  Kubernetes: z.int(),
  Mixed: z.boolean(),
  Podman: z.int(),
});

export const zEndpointgroupsEndpointGroupCreatePayload = z.object({
  AssociatedEndpoints: z.array(z.int()).optional(),
  Description: z.string().optional(),
  Name: z.string(),
  TagIDs: z.array(z.int()).optional(),
});

export const zEndpointsDockerhubStatusResponse = z.object({
  limit: z.int().optional(),
  remaining: z.int().optional(),
});

export const zEndpointsEndpointCreateGlobalKeyResponse = z.object({
  endpointID: z.int().optional(),
});

export const zEndpointsEndpointDeleteBatchPartialResponse = z.object({
  deleted: z.array(z.int()).optional(),
  errors: z.array(z.int()).optional(),
});

export const zEndpointsEndpointDeleteRequest = z.object({
  deleteCluster: z.boolean().optional(),
  id: z.int().optional(),
});

export const zEndpointsEndpointDeleteBatchPayload = z.object({
  endpoints: z.array(zEndpointsEndpointDeleteRequest).optional(),
});

export const zEndpointsEndpointUpdateRelationsPayload = z.object({
  Relations: z
    .record(
      z.string(),
      z.object({
        EdgeGroups: z.array(z.int()).optional(),
        Group: z.int().optional(),
        Tags: z.array(z.int()).optional(),
      })
    )
    .optional(),
});

export const zEndpointsForceUpdateServicePayload = z.object({
  PullImage: z.boolean().optional(),
  ServiceID: z.string().optional(),
});

export const zEndpointsGroupCount = z.object({
  count: z.int().optional(),
  groupID: z.int().optional(),
  groupName: z.string().optional(),
});

export const zEndpointsHealthCounts = z.object({
  down: z.int().optional(),
  heartbeat: z.int().optional(),
  outdated: z.int().optional(),
  up: z.int().optional(),
});

export const zEndpointsPlatformCounts = z.object({
  azure: z.int().optional(),
  docker: z.int().optional(),
  kubernetes: z.int().optional(),
  podman: z.int().optional(),
});

export const zEndpointsEnvironmentSummaryCountsResponse = z.object({
  byGroup: z.array(zEndpointsGroupCount).optional(),
  byHealth: zEndpointsHealthCounts.optional(),
  byPlatformType: zEndpointsPlatformCounts.optional(),
  down: z.int().optional(),
  outdated: z.int().optional(),
  total: z.int().optional(),
  unassigned: z.int().optional(),
  up: z.int().optional(),
});

export const zGitopsFileResponse = z.object({
  FileContent: z.string().optional(),
});

export const zGitopsRepositoryFilePreviewPayload = z.object({
  password: z.string().optional(),
  reference: z.string().optional(),
  repository: z.string().optional(),
  sourceID: z.int().optional(),
  targetFile: z.string().optional(),
  tlsSkipVerify: z.boolean().optional(),
  username: z.string().optional(),
});

export const zGittypesGitAuthentication = z.object({
  AuthorizationType: z.int().optional(),
  Password: z.string().optional(),
  Provider: z.int().optional(),
  Username: z.string().optional(),
});

export const zGittypesGitSource = z.object({
  Authentication: zGittypesGitAuthentication.optional(),
  TLSSkipVerify: z.boolean().optional(),
  URL: z.string().optional(),
});

export const zGittypesRepoConfig = z.object({
  Authentication: zGittypesGitAuthentication.optional(),
  ConfigFilePath: z.string().optional(),
  ConfigHash: z.string().optional(),
  ReferenceName: z.string().optional(),
  TLSSkipVerify: z.boolean().optional(),
  URL: z.string().optional(),
});

export const zHelmInstallChartPayload = z.object({
  atomic: z.boolean().optional(),
  chart: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  repo: z.string().optional(),
  values: z.string().optional(),
  version: z.string().optional(),
});

export const zImagesImageResponse = z.object({
  created: z.int().optional(),
  id: z.string().optional(),
  nodeName: z.string().optional(),
  size: z.int().optional(),
  tags: z.array(z.string()).optional(),
  used: z.boolean().optional(),
});

export const zIntstrType = z.union([z.literal(0), z.literal(1)]);

export const zIntstrIntOrString = z.object({
  IntVal: z.int().optional(),
  StrVal: z.string().optional(),
  Type: zIntstrType.optional(),
});

export const zK8sIoApiCoreV1ConditionStatus = z.enum([
  'True',
  'False',
  'Unknown',
]);

export const zK8sIoApiCoreV1HttpHeader = z.object({
  name: z.string().optional(),
  value: z.string().optional(),
});

export const zK8sIoApiCoreV1LocalObjectReference = z.object({
  name: z.string().optional(),
});

export const zK8sIoApiCoreV1ObjectReference = z.object({
  apiVersion: z.string().optional(),
  fieldPath: z.string().optional(),
  kind: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  resourceVersion: z.string().optional(),
  uid: z.string().optional(),
});

export const zK8sIoApiCoreV1ResourceClaim = z.object({
  name: z.string().optional(),
  request: z.string().optional(),
});

export const zK8sIoApiRbacV1Subject = z.object({
  apiGroup: z.string().optional(),
  kind: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
});

export const zKubernetesConfiguration = z.object({
  ConfigurationOwner: z.string().optional(),
  Data: z.record(z.string(), z.unknown()).optional(),
  Kind: z.string().optional(),
});

export const zKubernetesCustomResourceMetadata = z.object({
  apiVersion: z.string().optional(),
  kind: z.string().optional(),
  name: z.string().optional(),
  plural: z.string().optional(),
  scope: z.string().optional(),
});

export const zKubernetesK8sApplicationResource = z.object({
  CpuLimit: z.number().optional(),
  CpuRequest: z.number().optional(),
  MemoryLimit: z.int().optional(),
  MemoryRequest: z.int().optional(),
});

export const zKubernetesK8sClusterRole = z.object({
  creationDate: z.string().optional(),
  isSystem: z.boolean().optional(),
  name: z.string().optional(),
  uid: z.string().optional(),
});

export const zKubernetesK8sConfigurationOwnerResource = z.object({
  Id: z.string().optional(),
  Name: z.string().optional(),
  ResourceKind: z.string().optional(),
});

export const zKubernetesK8sConfigMap = z.object({
  Annotations: z.record(z.string(), z.string()).optional(),
  ConfigurationOwner: z.string().optional(),
  ConfigurationOwnerId: z.string().optional(),
  ConfigurationOwners: z
    .array(zKubernetesK8sConfigurationOwnerResource)
    .optional(),
  CreationDate: z.string().optional(),
  Data: z.record(z.string(), z.string()).optional(),
  IsUsed: z.boolean().optional(),
  Labels: z.record(z.string(), z.string()).optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  UID: z.string().optional(),
});

export const zKubernetesK8sCronJobDeleteRequests = z.record(
  z.string(),
  z.array(z.string())
);

export const zKubernetesK8sDashboard = z.object({
  applicationsCount: z.int().optional(),
  configMapsCount: z.int().optional(),
  ingressesCount: z.int().optional(),
  namespacesCount: z.int().optional(),
  secretsCount: z.int().optional(),
  servicesCount: z.int().optional(),
  volumesCount: z.int().optional(),
});

export const zKubernetesK8sEventInvolvedObject = z.object({
  kind: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  uid: z.string().optional(),
});

export const zKubernetesK8sEvent = z.object({
  count: z.int().optional(),
  eventTime: z.string().optional(),
  firstTimestamp: z.string().optional(),
  involvedObject: zKubernetesK8sEventInvolvedObject.optional(),
  kind: z.string().optional(),
  lastTimestamp: z.string().optional(),
  message: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  reason: z.string().optional(),
  type: z.string().optional(),
  uid: z.string().optional(),
});

export const zKubernetesK8sIngressController = z.object({
  Availability: z.boolean().optional(),
  ClassName: z.string().optional(),
  Name: z.string().optional(),
  New: z.boolean().optional(),
  Type: z.string().optional(),
  Used: z.boolean().optional(),
});

export const zKubernetesK8sIngressDeleteRequests = z.record(
  z.string(),
  z.array(z.string())
);

export const zKubernetesK8sIngressPath = z.object({
  HasService: z.boolean().optional(),
  Host: z.string().optional(),
  IngressName: z.string().optional(),
  Path: z.string().optional(),
  PathType: z.string().optional(),
  Port: z.int().optional(),
  ServiceName: z.string().optional(),
});

export const zKubernetesK8sIngressTls = z.object({
  Hosts: z.array(z.string()).optional(),
  SecretName: z.string().optional(),
});

export const zKubernetesK8sIngressInfo = z.object({
  Annotations: z.record(z.string(), z.string()).optional(),
  ClassName: z.string().optional(),
  CreationDate: z.string().optional(),
  Hosts: z.array(z.string()).optional(),
  Labels: z.record(z.string(), z.string()).optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  Paths: z.array(zKubernetesK8sIngressPath).optional(),
  TLS: z.array(zKubernetesK8sIngressTls).optional(),
  Type: z.string().optional(),
  UID: z.string().optional(),
});

export const zKubernetesK8sJobDeleteRequests = z.record(
  z.string(),
  z.array(z.string())
);

export const zKubernetesK8sPvcResizeRequest = z.object({
  name: z.string().optional(),
  namespace: z.string().optional(),
  newSize: z.string().optional(),
});

export const zKubernetesK8sResourceQuota = z.object({
  cpu: z.string().optional(),
  enabled: z.boolean().optional(),
  memory: z.string().optional(),
});

export const zKubernetesK8sNamespaceDetails = z.object({
  Annotations: z.record(z.string(), z.string()).optional(),
  Name: z.string().optional(),
  Owner: z.string().optional(),
  ResourceQuota: zKubernetesK8sResourceQuota.optional(),
});

export const zKubernetesK8sRole = z.object({
  creationDate: z.string().optional(),
  isSystem: z.boolean().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  uid: z.string().optional(),
});

export const zKubernetesK8sRoleBindingDeleteRequests = z.record(
  z.string(),
  z.array(z.string())
);

export const zKubernetesK8sRoleDeleteRequests = z.record(
  z.string(),
  z.array(z.string())
);

export const zKubernetesK8sSecret = z.object({
  Annotations: z.record(z.string(), z.string()).optional(),
  ConfigurationOwner: z.string().optional(),
  ConfigurationOwnerId: z.string().optional(),
  ConfigurationOwners: z
    .array(zKubernetesK8sConfigurationOwnerResource)
    .optional(),
  CreationDate: z.string().optional(),
  Data: z.record(z.string(), z.string()).optional(),
  IsUsed: z.boolean().optional(),
  Labels: z.record(z.string(), z.string()).optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  SecretType: z.string().optional(),
  UID: z.string().optional(),
});

export const zKubernetesK8sServiceAccount = z.object({
  annotations: z.record(z.string(), z.string()).optional(),
  automountServiceAccountToken: z.boolean().optional(),
  creationDate: z.string().optional(),
  imagePullSecrets: z.array(zK8sIoApiCoreV1LocalObjectReference).optional(),
  isSystem: z.boolean().optional(),
  labels: z.record(z.string(), z.string()).optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  uid: z.string().optional(),
});

export const zKubernetesK8sServiceAccountDeleteRequests = z.record(
  z.string(),
  z.array(z.string())
);

export const zKubernetesK8sServiceAccountImagePullSecretsUpdatePayload =
  z.object({
    secretNames: z.array(z.string()).optional(),
  });

export const zKubernetesK8sServiceDeleteRequests = z.record(
  z.string(),
  z.array(z.string())
);

export const zKubernetesK8sServiceIngress = z.object({
  Hostname: z.string().optional(),
  IP: z.string().optional(),
});

export const zKubernetesK8sServicePort = z.object({
  Name: z.string().optional(),
  NodePort: z.int().optional(),
  Port: z.int().optional(),
  Protocol: z.string().optional(),
  TargetPort: z.string().optional(),
});

export const zKubernetesK8sVolumeDeleteRequest = z.object({
  name: z.string().optional(),
  namespace: z.string().optional(),
});

export const zKubernetesMetadata = z.object({
  annotations: z.record(z.string(), z.string()).optional(),
  labels: z.record(z.string(), z.string()).optional(),
});

export const zKubernetesPod = z.object({
  ContainerName: z.string().optional(),
  CreationDate: z.string().optional(),
  Image: z.string().optional(),
  ImagePullPolicy: z.string().optional(),
  Name: z.string().optional(),
  NodeName: z.string().optional(),
  PodIP: z.string().optional(),
  Resource: zKubernetesK8sApplicationResource.optional(),
  Status: z.string().optional(),
  Uid: z.string().optional(),
});

export const zKubernetesTlsInfo = z.object({
  hosts: z.array(z.string()).optional(),
});

export const zKubernetesIngressRule = z.object({
  Host: z.string().optional(),
  IP: z.string().optional(),
  Path: z.string().optional(),
  TLS: z.array(zKubernetesTlsInfo).optional(),
});

export const zKubernetesPublishedPort = z.object({
  IngressRules: z.array(zKubernetesIngressRule).optional(),
  Port: z.int().optional(),
});

export const zKubernetesK8sApplication = z.object({
  Annotations: z.record(z.string(), z.string()).optional(),
  ApplicationOwner: z.string().optional(),
  ApplicationType: z.string().optional(),
  Configurations: z.array(zKubernetesConfiguration).optional(),
  Containers: z.array(z.unknown()).optional(),
  CreationDate: z.string().optional(),
  CustomResourceMetadata: zKubernetesCustomResourceMetadata.optional(),
  DeploymentType: z.string().optional(),
  Id: z.string().optional(),
  Image: z.string().optional(),
  Kind: z.string().optional(),
  Labels: z.record(z.string(), z.string()).optional(),
  LoadBalancerIPAddress: z.string().optional(),
  MatchLabels: z.record(z.string(), z.string()).optional(),
  Metadata: zKubernetesMetadata.optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  Pods: z.array(zKubernetesPod).optional(),
  PublishedPorts: z.array(zKubernetesPublishedPort).optional(),
  Resource: zKubernetesK8sApplicationResource.optional(),
  ResourcePool: z.string().optional(),
  RunningPodsCount: z.int().optional(),
  ServiceId: z.string().optional(),
  ServiceName: z.string().optional(),
  ServiceType: z.string().optional(),
  StackId: z.string().optional(),
  StackKind: z.string().optional(),
  StackName: z.string().optional(),
  Status: z.string().optional(),
  TotalPodsCount: z.int().optional(),
  Uid: z.string().optional(),
});

export const zKubernetesK8sServiceInfo = z.object({
  AllocateLoadBalancerNodePorts: z.boolean().optional(),
  Annotations: z.record(z.string(), z.string()).optional(),
  Applications: z.array(zKubernetesK8sApplication).optional(),
  ClusterIPs: z.array(z.string()).optional(),
  CreationDate: z.string().optional(),
  ExternalIPs: z.array(z.string()).optional(),
  ExternalName: z.string().optional(),
  IngressStatus: z.array(zKubernetesK8sServiceIngress).optional(),
  Labels: z.record(z.string(), z.string()).optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  Ports: z.array(zKubernetesK8sServicePort).optional(),
  Selector: z.record(z.string(), z.string()).optional(),
  Type: z.string().optional(),
  UID: z.string().optional(),
});

export const zKubernetesDescribeResourceResponse = z.object({
  describe: z.string().optional(),
});

export const zKubernetesKubernetesVersionResponse = z.object({
  buildDate: z.string().optional(),
  compiler: z.string().optional(),
  emulationMajor: z.string().optional(),
  emulationMinor: z.string().optional(),
  gitCommit: z.string().optional(),
  gitTreeState: z.string().optional(),
  gitVersion: z.string().optional(),
  goVersion: z.string().optional(),
  major: z.string().optional(),
  minCompatibilityMajor: z.string().optional(),
  minCompatibilityMinor: z.string().optional(),
  minor: z.string().optional(),
  platform: z.string().optional(),
  supportsPodRestart: z.boolean().optional(),
});

export const zKubernetesNamespacesToggleSystemPayload = z.object({
  System: z.boolean().optional(),
});

export const zMotdMotd = z.object({
  ContentLayout: z.record(z.string(), z.string()).optional(),
  Hash: z.array(z.int()).optional(),
  Message: z.string().optional(),
  Style: z.string().optional(),
  Title: z.string().optional(),
});

export const zOauth2AuthStyle = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
]);

export const zPlatformContainerPlatform = z.enum([
  'Docker',
  'Docker Standalone',
  'Docker Swarm',
  'Kubernetes',
  'Podman',
]);

export const zPortainerApiKey = z.object({
  dateCreated: z.int().optional(),
  description: z.string().optional(),
  digest: z.string().optional(),
  id: z.int().optional(),
  lastUsed: z.int().optional(),
  prefix: z.string().optional(),
  userId: z.int().optional(),
});

export const zPortainerAccessPolicy = z.object({
  Namespaces: z.array(z.string()).optional(),
  RoleId: z.int(),
});

export const zPortainerAuthenticationMethod = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
]);

export const zPortainerAuthorizations = z.record(z.string(), z.boolean());

export const zPortainerAutoUpdateSettings = z.object({
  ForcePullImage: z.boolean().optional(),
  ForceUpdate: z.boolean().optional(),
  Interval: z.string().optional(),
  JobID: z.string().optional(),
  Webhook: z.string().optional(),
});

export const zPortainerAzureCredentials = z.object({
  ApplicationID: z.string(),
  AuthenticationKey: z.string(),
  TenantID: z.string(),
});

export const zPortainerCustomTemplatePlatform = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
]);

export const zPortainerCustomTemplateVariableDefinition = z.object({
  defaultValue: z.string().optional(),
  description: z.string().optional(),
  label: z.string().optional(),
  name: z.string().optional(),
});

export const zCustomtemplatesCustomTemplateFromFileContentPayload = z.object({
  Description: z.string(),
  EdgeTemplate: z.boolean().optional(),
  FileContent: z.string(),
  Logo: z.string().optional(),
  Note: z.string().optional(),
  Platform: z.union([z.literal(1), z.literal(2)]).optional(),
  Title: z.string(),
  Type: z.union([z.literal(1), z.literal(2), z.literal(3)]),
  Variables: z.array(zPortainerCustomTemplateVariableDefinition).optional(),
});

export const zCustomtemplatesCustomTemplateFromGitRepositoryPayload = z.object({
  ComposeFilePathInRepository: z
    .string()
    .optional()
    .default('docker-compose.yml'),
  Description: z.string(),
  EdgeTemplate: z.boolean().optional(),
  IsComposeFormat: z.boolean().optional(),
  Logo: z.string().optional(),
  Note: z.string().optional(),
  Platform: z.union([z.literal(1), z.literal(2)]).optional(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  SourceID: z.int(),
  TLSSkipVerify: z.boolean().optional(),
  Title: z.string(),
  Type: z.union([z.literal(1), z.literal(2)]),
  Variables: z.array(zPortainerCustomTemplateVariableDefinition).optional(),
});

export const zCustomtemplatesCustomTemplateUpdatePayload = z.object({
  ComposeFilePathInRepository: z
    .string()
    .optional()
    .default('docker-compose.yml'),
  Description: z.string(),
  EdgeTemplate: z.boolean().optional(),
  FileContent: z.string(),
  IsComposeFormat: z.boolean().optional(),
  Logo: z.string().optional(),
  Note: z.string().optional(),
  Platform: z.union([z.literal(1), z.literal(2)]).optional(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  SourceID: z.int().optional(),
  TLSSkipVerify: z.boolean().optional(),
  Title: z.string(),
  Type: z.union([z.literal(1), z.literal(2), z.literal(3)]),
  Variables: z.array(zPortainerCustomTemplateVariableDefinition).optional(),
});

export const zPortainerDiagnosticsData = z.object({
  DNS: z.record(z.string(), z.string()).optional(),
  Log: z.string().optional(),
  Proxy: z.record(z.string(), z.string()).optional(),
  Telnet: z.record(z.string(), z.string()).optional(),
});

export const zPortainerDockerSnapshotRaw = z.record(z.string(), z.unknown());

export const zPortainerEcrData = z.object({
  Region: z.string().optional(),
});

export const zPortainerEdge = z.object({
  AsyncMode: z.boolean().optional(),
  CommandInterval: z.int().optional(),
  PingInterval: z.int().optional(),
  SnapshotInterval: z.int().optional(),
});

export const zPortainerEdgeJobLogsStatus = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
]);

export const zEdgejobsTaskContainer = z.object({
  EndpointId: z.int().optional(),
  EndpointName: z.string().optional(),
  Id: z.string().optional(),
  LogsStatus: zPortainerEdgeJobLogsStatus.optional(),
});

export const zPortainerEdgeJobEndpointMeta = z.object({
  CollectLogs: z.boolean().optional(),
  LogsStatus: zPortainerEdgeJobLogsStatus.optional(),
});

export const zPortainerEdgeJob = z.object({
  Created: z.int().optional(),
  CronExpression: z.string().optional(),
  EdgeGroups: z.array(z.int()).optional(),
  Endpoints: z.record(z.string(), zPortainerEdgeJobEndpointMeta).optional(),
  GroupLogsCollection: z
    .record(z.string(), zPortainerEdgeJobEndpointMeta)
    .optional(),
  Id: z.int().optional(),
  Name: z.string().optional(),
  Recurring: z.boolean().optional(),
  ScriptPath: z.string().optional(),
  Version: z.int().optional(),
});

export const zPortainerEdgeStackDeploymentType = z.union([
  z.literal(0),
  z.literal(1),
]);

export const zEdgestacksUpdateEdgeStackPayload = z.object({
  DeploymentType: zPortainerEdgeStackDeploymentType.optional(),
  EdgeGroups: z.array(z.int()).optional(),
  StackFileContent: z.string().optional(),
  UpdateVersion: z.boolean().optional(),
  UseManifestNamespaces: z.boolean().optional(),
});

export const zPortainerEdgeStackStatusDetails = z.object({
  Acknowledged: z.boolean().optional(),
  Error: z.boolean().optional(),
  ImagesPulled: z.boolean().optional(),
  Ok: z.boolean().optional(),
  Pending: z.boolean().optional(),
  RemoteUpdateSuccess: z.boolean().optional(),
  Remove: z.boolean().optional(),
});

export const zPortainerEdgeStackStatusType = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
  z.literal(4),
  z.literal(5),
  z.literal(6),
  z.literal(7),
  z.literal(8),
  z.literal(9),
  z.literal(10),
  z.literal(11),
  z.literal(12),
  z.literal(13),
]);

export const zEdgestacksUpdateStatusPayload = z.object({
  EndpointID: z.int().optional(),
  Error: z.string().optional(),
  Status: zPortainerEdgeStackStatusType.optional(),
  Time: z.coerce
    .bigint()
    .min(BigInt('-9223372036854775808'), {
      error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
    })
    .max(BigInt('9223372036854775807'), {
      error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
    })
    .optional(),
  Version: z.int().optional(),
});

export const zPortainerEdgeStackDeploymentStatus = z.object({
  Error: z.string().optional(),
  RollbackTo: z.int().optional(),
  Time: z.coerce
    .bigint()
    .min(BigInt('-9223372036854775808'), {
      error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
    })
    .max(BigInt('9223372036854775807'), {
      error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
    })
    .optional(),
  Type: zPortainerEdgeStackStatusType.optional(),
  Version: z.int().optional(),
});

export const zPortainerEndpointSecuritySettings = z.object({
  allowBindMountsForRegularUsers: z.boolean(),
  allowContainerCapabilitiesForRegularUsers: z.boolean(),
  allowDeviceMappingForRegularUsers: z.boolean(),
  allowHostNamespaceForRegularUsers: z.boolean(),
  allowPrivilegedModeForRegularUsers: z.boolean(),
  allowSecurityOptForRegularUsers: z.boolean(),
  allowStackManagementForRegularUsers: z.boolean(),
  allowSysctlSettingForRegularUsers: z.boolean(),
  allowVolumeBrowserForRegularUsers: z.boolean(),
  enableHostManagementFeatures: z.boolean(),
});

export const zPortainerEndpointStatus = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
]);

export const zPortainerEndpointType = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
  z.literal(4),
  z.literal(5),
  z.literal(6),
  z.literal(7),
]);

export const zEdgegroupsDecoratedEdgeGroup = z.object({
  Dynamic: z.boolean().optional(),
  EndpointIds: z.int().optional(),
  EndpointTypes: z.array(zPortainerEndpointType).optional(),
  Endpoints: z.array(z.int()).optional(),
  HasEdgeJob: z.boolean().optional(),
  HasEdgeStack: z.boolean().optional(),
  Id: z.int().optional(),
  Name: z.string().optional(),
  PartialMatch: z.boolean().optional(),
  TagIds: z.array(z.int()).optional(),
  TrustedEndpoints: z.array(z.int()).optional(),
});

export const zPortainerEnvironmentAgentData = z.object({
  Version: z.string().optional(),
});

export const zPortainerEnvironmentEdgeSettings = z.object({
  AsyncMode: z.boolean(),
  CommandInterval: z.int(),
  PingInterval: z.int(),
  SnapshotInterval: z.int(),
});

export const zPortainerGithubRegistryData = z.object({
  OrganisationName: z.string().optional(),
  UseOrganisation: z.boolean().optional(),
});

export const zPortainerGitlabRegistryData = z.object({
  InstanceURL: z.string().optional(),
  ProjectId: z.int().optional(),
  ProjectPath: z.string().optional(),
});

export const zPortainerGlobalDeploymentOptions = z.object({
  hideStacksFunctionality: z.boolean().optional(),
});

export const zPortainerHelmConfig = z.object({
  Atomic: z.boolean().optional(),
  ChartName: z.string().optional(),
  ChartPath: z.string().optional(),
  ChartURL: z.string().optional(),
  ChartVersion: z.string().optional(),
  Namespace: z.string().optional(),
  Timeout: z.string().optional(),
  ValuesFiles: z.array(z.string()).optional(),
  ValuesInline: z.string().optional(),
});

export const zPortainerHelmUserRepository = z.object({
  Id: z.int().optional(),
  URL: z.string().optional(),
  UserId: z.int().optional(),
});

export const zPortainerInternalAuthSettings = z.object({
  RequiredPasswordLength: z.int().optional(),
});

export const zPortainerK8sNodeLimits = z.object({
  CPU: z.int().optional(),
  Memory: z.int().optional(),
});

export const zPortainerK8sNodesLimits = z.record(
  z.string(),
  zPortainerK8sNodeLimits
);

export const zPortainerKubernetesFlags = z.object({
  GPUOperator: z.boolean().optional(),
  IsServerIngressClassDetected: z.boolean(),
  IsServerMetricsDetected: z.boolean(),
  IsServerStorageDetected: z.boolean(),
});

export const zPortainerKubernetesIngressClassConfig = z.object({
  Blocked: z.boolean().optional(),
  BlockedNamespaces: z.array(z.string()).optional(),
  Name: z.string(),
  Type: z.string(),
});

export const zPortainerKubernetesStorageClassConfig = z.object({
  AccessModes: z.array(z.string()).optional(),
  AllowVolumeExpansion: z.boolean(),
  Name: z.string(),
  Provisioner: z.string(),
});

export const zPortainerKubernetesConfiguration = z.object({
  AllowNoneIngressClass: z.boolean(),
  EnableResourceOverCommit: z.boolean().optional(),
  IngressAvailabilityPerNamespace: z.boolean(),
  IngressClasses: z.array(zPortainerKubernetesIngressClassConfig).optional(),
  ResourceOverCommitPercentage: z.int().optional(),
  RestrictDefaultNamespace: z.boolean().optional(),
  StorageClasses: z.array(zPortainerKubernetesStorageClassConfig).optional(),
  UseLoadBalancer: z.boolean().optional(),
  UseServerMetrics: z.boolean().optional(),
});

export const zPortainerLdapGroupSearchSettings = z.object({
  GroupAttribute: z.string().optional(),
  GroupBaseDN: z.string().optional(),
  GroupFilter: z.string().optional(),
});

export const zPortainerLdapSearchSettings = z.object({
  BaseDN: z.string().optional(),
  Filter: z.string().optional(),
  UserNameAttribute: z.string().optional(),
});

export const zPortainerMembershipRole = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
]);

export const zPortainerOAuthSettings = z.object({
  AccessTokenURI: z.string().optional(),
  AuthStyle: zOauth2AuthStyle.optional(),
  AuthorizationURI: z.string().optional(),
  ClientID: z.string().optional(),
  ClientSecret: z.string().optional(),
  DefaultTeamID: z.int().optional(),
  KubeSecretKey: z.array(z.int()).optional(),
  LogoutURI: z.string().optional(),
  OAuthAutoCreateUsers: z.boolean().optional(),
  RedirectURI: z.string().optional(),
  ResourceURI: z.string().optional(),
  SSO: z.boolean().optional(),
  Scopes: z.string().optional(),
  UserIdentifier: z.string().optional(),
});

export const zPortainerPair = z.object({
  name: z.string(),
  value: z.string(),
});

export const zEndpointsEndpointSettingsUpdatePayload = z.object({
  allowBindMountsForRegularUsers: z.boolean().optional(),
  allowContainerCapabilitiesForRegularUsers: z.boolean().optional(),
  allowDeviceMappingForRegularUsers: z.boolean().optional(),
  allowHostNamespaceForRegularUsers: z.boolean().optional(),
  allowPrivilegedModeForRegularUsers: z.boolean().optional(),
  allowSecurityOptForRegularUsers: z.boolean().optional(),
  allowStackManagementForRegularUsers: z.boolean().optional(),
  allowSysctlSettingForRegularUsers: z.boolean().optional(),
  allowVolumeBrowserForRegularUsers: z.boolean().optional(),
  enableGPUManagement: z.boolean().optional(),
  enableHostManagementFeatures: z.boolean().optional(),
  gpus: z.array(zPortainerPair).optional(),
});

export const zPortainerPerformanceMetrics = z.object({
  CPUUsage: z.number().optional(),
  DiskUsage: z.number().optional(),
  MemoryUsage: z.number().optional(),
  NetworkUsage: z.number().optional(),
});

export const zPortainerDockerSnapshot = z.object({
  ContainerCount: z.int(),
  DiagnosticsData: zPortainerDiagnosticsData.optional(),
  DockerSnapshotRaw: zPortainerDockerSnapshotRaw.optional(),
  DockerVersion: z.string(),
  GpuUseAll: z.boolean(),
  GpuUseList: z.array(z.string()).optional(),
  HealthyContainerCount: z.int(),
  ImageCount: z.int(),
  IsPodman: z.boolean(),
  NodeCount: z.int(),
  PerformanceMetrics: zPortainerPerformanceMetrics.optional(),
  RunningContainerCount: z.int(),
  ServiceCount: z.int(),
  StackCount: z.int(),
  StoppedContainerCount: z.int(),
  Swarm: z.boolean(),
  Time: z.int(),
  TotalCPU: z.int(),
  TotalMemory: z.int(),
  UnhealthyContainerCount: z.int(),
  VolumeCount: z.int(),
});

export const zPortainerKubernetesSnapshot = z.object({
  ClusterType: z.string().optional(),
  DiagnosticsData: zPortainerDiagnosticsData.optional(),
  GPUNodeCount: z.int().optional(),
  KubernetesVersion: z.string(),
  NodeCount: z.int(),
  PerformanceMetrics: zPortainerPerformanceMetrics.optional(),
  Time: z.int(),
  TotalCPU: z.int(),
  TotalGPU: z
    .record(
      z.string(),
      z.coerce
        .bigint()
        .min(BigInt('-9223372036854775808'), {
          error: 'Invalid value: Expected int64 to be >= -9223372036854775808',
        })
        .max(BigInt('9223372036854775807'), {
          error: 'Invalid value: Expected int64 to be <= 9223372036854775807',
        })
    )
    .optional(),
  TotalMemory: z.int(),
});

export const zPortainerKubernetesData = z.object({
  Configuration: zPortainerKubernetesConfiguration,
  Flags: zPortainerKubernetesFlags,
  Snapshots: z.array(zPortainerKubernetesSnapshot).optional(),
});

export const zPortainerQuayRegistryData = z.object({
  OrganisationName: z.string().optional(),
  UseOrganisation: z.boolean().optional(),
});

export const zPortainerRegistryType = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
  z.literal(4),
  z.literal(5),
  z.literal(6),
  z.literal(7),
  z.literal(8),
]);

export const zPortainerResourceAccessLevel = z.union([
  z.literal(0),
  z.literal(1),
]);

export const zPortainerResourceControlType = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
  z.literal(4),
  z.literal(5),
  z.literal(6),
  z.literal(7),
  z.literal(8),
  z.literal(9),
]);

export const zPortainerRole = z.object({
  Authorizations: zPortainerAuthorizations.optional(),
  Description: z.string().optional(),
  Id: z.int().optional(),
  Name: z.string().optional(),
  Priority: z.int().optional(),
});

export const zPortainerSslSettings = z.object({
  certPath: z.string().optional(),
  httpEnabled: z.boolean().optional(),
  keyPath: z.string().optional(),
  selfSigned: z.boolean().optional(),
});

export const zPortainerSourceStatus = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
]);

export const zPortainerArtifactFile = z.object({
  hash: z.string().optional(),
  path: z.string().optional(),
  pathError: z.string().optional(),
  pathStatus: zPortainerSourceStatus.optional(),
  ref: z.string().optional(),
  refError: z.string().optional(),
  refStatus: zPortainerSourceStatus.optional(),
  sourceId: z.int().optional(),
});

export const zPortainerArtifact = z.object({
  edgeGroups: z.array(z.int()).optional(),
  edgeStackId: z.int().optional(),
  envGroups: z.array(z.int()).optional(),
  envIds: z.array(z.int()).optional(),
  files: z.array(zPortainerArtifactFile).optional(),
  stackId: z.int().optional(),
});

export const zPortainerSourceType = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
]);

export const zPortainerStackDeploymentInfo = z.object({
  AdditionalFiles: z.array(z.string()).optional(),
  ConfigFilePath: z.string().optional(),
  ConfigHash: z.string().optional(),
  FileVersion: z.int().optional(),
  ReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  SourceID: z.int().optional(),
  Version: z.int().optional(),
});

export const zPortainerEdgeStackStatus = z.object({
  DeploymentInfo: zPortainerStackDeploymentInfo.optional(),
  Details: zPortainerEdgeStackStatusDetails.optional(),
  EndpointID: z.int().optional(),
  Error: z.string().optional(),
  ReadyRePullImage: z.boolean().optional(),
  Status: z.array(zPortainerEdgeStackDeploymentStatus).optional(),
  Type: zPortainerEdgeStackStatusType.optional(),
});

export const zPortainerEdgeStack = z.object({
  CreatedBy: z.string().optional(),
  CreatedByUserId: z.string().optional(),
  CreationDate: z.int().optional(),
  DeploymentType: zPortainerEdgeStackDeploymentType.optional(),
  EdgeGroups: z.array(z.int()).optional(),
  EntryPoint: z.string().optional(),
  Id: z.int().optional(),
  ManifestPath: z.string().optional(),
  Name: z.string().optional(),
  NumDeployments: z.int().optional(),
  ProjectPath: z.string().optional(),
  Status: z.record(z.string(), zPortainerEdgeStackStatus).optional(),
  UseManifestNamespaces: z.boolean().optional(),
  Version: z.int().optional(),
});

export const zPortainerStackOption = z.object({
  HelmAtomic: z.boolean().optional(),
  Prune: z.boolean().optional(),
});

export const zPortainerStackStatus = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
  z.literal(4),
]);

export const zPortainerStackDeploymentStatus = z.object({
  Message: z.string().optional(),
  Status: zPortainerStackStatus.optional(),
  Time: z.int().optional(),
});

export const zPortainerStackType = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
]);

export const zPortainerTlsConfiguration = z.object({
  TLS: z.boolean(),
  TLSCACert: z.string().optional(),
  TLSCert: z.string().optional(),
  TLSKey: z.string().optional(),
  TLSSkipVerify: z.boolean(),
});

export const zPortainerLdapSettings = z.object({
  AnonymousMode: z.boolean().optional(),
  AutoCreateUsers: z.boolean().optional(),
  GroupSearchSettings: z.array(zPortainerLdapGroupSearchSettings).optional(),
  Password: z.string().optional(),
  ReaderDN: z.string().optional(),
  SearchSettings: z.array(zPortainerLdapSearchSettings).optional(),
  StartTLS: z.boolean().optional(),
  TLSConfig: zPortainerTlsConfiguration.optional(),
  URL: z.string().optional(),
});

export const zLdapCheckPayload = z.object({
  LDAPSettings: zPortainerLdapSettings.optional(),
});

export const zPortainerRegistryManagementConfiguration = z.object({
  AccessToken: z.string().optional(),
  AccessTokenExpiry: z.int().optional(),
  Authentication: z.boolean().optional(),
  Ecr: zPortainerEcrData.optional(),
  Password: z.string().optional(),
  TLSConfig: zPortainerTlsConfiguration.optional(),
  Type: zPortainerRegistryType.optional(),
  Username: z.string().optional(),
});

export const zPortainerSettings = z.object({
  AgentSecret: z.string().optional(),
  AllowBindMountsForRegularUsers: z.boolean().optional(),
  AllowContainerCapabilitiesForRegularUsers: z.boolean().optional(),
  AllowDeviceMappingForRegularUsers: z.boolean().optional(),
  AllowHostNamespaceForRegularUsers: z.boolean().optional(),
  AllowPrivilegedModeForRegularUsers: z.boolean().optional(),
  AllowStackManagementForRegularUsers: z.boolean().optional(),
  AllowVolumeBrowserForRegularUsers: z.boolean().optional(),
  AuthenticationMethod: zPortainerAuthenticationMethod.optional(),
  BlackListedLabels: z.array(zPortainerPair).optional(),
  DisplayDonationHeader: z.boolean().optional(),
  DisplayExternalContributors: z.boolean().optional(),
  Edge: zPortainerEdge.optional(),
  EdgeAgentCheckinInterval: z.int().optional(),
  EdgePortainerUrl: z.string().optional(),
  EnableEdgeComputeFeatures: z.boolean().optional(),
  EnableHostManagementFeatures: z.boolean().optional(),
  EnforceEdgeID: z.boolean().optional(),
  FeatureFlagSettings: z.record(z.string(), z.boolean()).optional(),
  ForceSecureCookies: z.boolean().optional(),
  GlobalDeploymentOptions: zPortainerGlobalDeploymentOptions.optional(),
  HelmRepositoryURL: z.string().optional(),
  InternalAuthSettings: zPortainerInternalAuthSettings.optional(),
  IsDockerDesktopExtension: z.boolean().optional(),
  KubeconfigExpiry: z.string().optional(),
  KubectlShellImage: z.string().optional(),
  LDAPSettings: zPortainerLdapSettings.optional(),
  LogoURL: z.string().optional(),
  OAuthSettings: zPortainerOAuthSettings.optional(),
  SnapshotInterval: z.string().optional(),
  TemplatesURL: z.string().optional(),
  TrustOnFirstConnect: z.boolean().optional(),
  UserSessionTimeout: z.string().optional(),
});

export const zPortainerTag = z.object({
  EndpointGroups: z.record(z.string(), z.boolean()).optional(),
  Endpoints: z.record(z.string(), z.boolean()).optional(),
  ID: z.int().optional(),
  Name: z.string().optional(),
});

export const zPortainerTeam = z.object({
  Id: z.int().optional(),
  Name: z.string().optional(),
});

export const zPortainerTeamAccessPolicies = z.record(
  z.string(),
  zPortainerAccessPolicy
);

export const zPortainerTeamMembership = z.object({
  Id: z.int().optional(),
  Role: zPortainerMembershipRole.optional(),
  TeamID: z.int().optional(),
  UserID: z.int().optional(),
});

export const zPortainerTeamResourceAccess = z.object({
  AccessLevel: zPortainerResourceAccessLevel.optional(),
  TeamId: z.int().optional(),
});

export const zPortainerTemplateEnvSelect = z.object({
  default: z.boolean().optional(),
  text: z.string().optional(),
  value: z.string().optional(),
});

export const zPortainerTemplateEnv = z.object({
  default: z.string().optional(),
  description: z.string().optional(),
  label: z.string().optional(),
  name: z.string().optional(),
  preset: z.boolean().optional(),
  select: z.array(zPortainerTemplateEnvSelect).optional(),
});

export const zPortainerTemplateRepository = z.object({
  stackfile: z.string().optional(),
  url: z.string().optional(),
});

export const zPortainerTemplateType = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
  z.literal(3),
]);

export const zPortainerTemplateVolume = z.object({
  bind: z.string().optional(),
  container: z.string().optional(),
  readonly: z.boolean().optional(),
});

export const zPortainerTemplate = z.object({
  administrator_only: z.boolean().optional(),
  categories: z.array(z.string()).optional(),
  command: z.string().optional(),
  description: z.string().optional(),
  env: z.array(zPortainerTemplateEnv).optional(),
  hostname: z.string().optional(),
  id: z.int().optional(),
  image: z.string().optional(),
  interactive: z.boolean().optional(),
  labels: z.array(zPortainerPair).optional(),
  logo: z.string().optional(),
  name: z.string().optional(),
  network: z.string().optional(),
  note: z.string().optional(),
  platform: z.string().optional(),
  ports: z.array(z.string()).optional(),
  privileged: z.boolean().optional(),
  registry: z.string().optional(),
  repository: zPortainerTemplateRepository.optional(),
  restart_policy: z.string().optional(),
  stackFile: z.string().optional(),
  title: z.string().optional(),
  type: zPortainerTemplateType.optional(),
  volumes: z.array(zPortainerTemplateVolume).optional(),
});

export const zPortainerUserAccessPolicies = z.record(
  z.string(),
  zPortainerAccessPolicy
);

export const zEndpointgroupsEndpointGroupResponse = z.object({
  Description: z.string(),
  Id: z.int(),
  Name: z.string(),
  TagIds: z.array(z.int()).optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  Total: z.int().optional(),
  TypeInfo: zEndpointgroupsEndpointGroupTypeInfo.optional(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
});

export const zEndpointgroupsEndpointGroupUpdatePayload = z.object({
  AssociatedEndpoints: z.array(z.int()).optional(),
  Description: z.string().optional(),
  Name: z.string().optional(),
  TagIDs: z.array(z.int()).optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
});

export const zEndpointsEndpointUpdatePayload = z.object({
  AzureApplicationID: z.string().optional(),
  AzureAuthenticationKey: z.string().optional(),
  AzureTenantID: z.string().optional(),
  EdgeCheckinInterval: z.int().optional(),
  Gpus: z.array(zPortainerPair).optional(),
  GroupID: z.int().optional(),
  Kubernetes: zPortainerKubernetesData.optional(),
  Name: z.string().optional(),
  PublicURL: z.string().optional(),
  Status: z.int().optional(),
  TLS: z.boolean().optional(),
  TLSSkipClientVerify: z.boolean().optional(),
  TLSSkipVerify: z.boolean().optional(),
  TagIDs: z.array(z.int()).optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  URL: z.string().optional(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
});

export const zEndpointsRegistryAccessPayload = z.object({
  Namespaces: z.array(z.string()).optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
});

export const zPortainerEndpoint = z.object({
  Agent: zPortainerEnvironmentAgentData,
  AzureCredentials: zPortainerAzureCredentials.optional(),
  ComposeSyntaxMaxVersion: z.string(),
  ContainerEngine: z.string(),
  Edge: zPortainerEnvironmentEdgeSettings,
  EdgeCheckinInterval: z.int(),
  EdgeID: z.string().optional(),
  EdgeKey: z.string(),
  EnableGPUManagement: z.boolean().optional(),
  Gpus: z.array(zPortainerPair).optional(),
  GroupId: z.int(),
  Heartbeat: z.boolean().optional(),
  Id: z.int(),
  Kubernetes: zPortainerKubernetesData,
  LastCheckInDate: z.int(),
  Name: z.string(),
  PublicURL: z.string(),
  SecuritySettings: zPortainerEndpointSecuritySettings,
  Snapshots: z.array(zPortainerDockerSnapshot).optional(),
  Status: z
    .union([z.literal(1), z.literal(2), z.literal(3), z.literal(4)])
    .optional(),
  TLSConfig: zPortainerTlsConfiguration,
  TagIds: z.array(z.int()).optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  Type: zPortainerEndpointType,
  URL: z.string(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
  UserTrusted: z.boolean().optional(),
});

export const zPortainerEndpointGroup = z.object({
  Description: z.string(),
  Id: z.int(),
  Name: z.string(),
  TagIds: z.array(z.int()).optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
});

export const zPortainerRegistryAccessPolicies = z.object({
  Namespaces: z.array(z.string()).optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
});

export const zPortainerRegistryAccesses = z.record(
  z.string(),
  zPortainerRegistryAccessPolicies
);

export const zPortainerRegistry = z.object({
  AccessToken: z.string().optional(),
  AccessTokenExpiry: z.int().optional(),
  Authentication: z.boolean().optional(),
  AuthorizedTeams: z.array(z.int()).optional(),
  AuthorizedUsers: z.array(z.int()).optional(),
  BaseURL: z.string().optional(),
  Ecr: zPortainerEcrData.optional(),
  Github: zPortainerGithubRegistryData.optional(),
  Gitlab: zPortainerGitlabRegistryData.optional(),
  Id: z.int().optional(),
  ManagementConfiguration: zPortainerRegistryManagementConfiguration.optional(),
  Name: z.string().optional(),
  Password: z.string().optional(),
  Quay: zPortainerQuayRegistryData.optional(),
  RegistryAccesses: zPortainerRegistryAccesses.optional(),
  TeamAccessPolicies: zPortainerTeamAccessPolicies.optional(),
  Type: z
    .union([
      z.literal(1),
      z.literal(2),
      z.literal(3),
      z.literal(4),
      z.literal(5),
      z.literal(6),
      z.literal(7),
    ])
    .optional(),
  URL: z.string().optional(),
  UserAccessPolicies: zPortainerUserAccessPolicies.optional(),
  Username: z.string().optional(),
});

export const zPortainerSource = z.object({
  administratorsOnly: z.boolean().optional(),
  git: zGittypesGitSource.optional(),
  helm: zPortainerHelmConfig.optional(),
  id: z.int().optional(),
  interval: z.string().optional(),
  lastSync: z.int().optional(),
  name: z.string().optional(),
  ownerID: z.int().optional(),
  public: z.boolean().optional(),
  registry: zPortainerRegistry.optional(),
  status: zPortainerSourceStatus.optional(),
  statusError: z.string().optional(),
  teamAccesses: z.array(z.int()).optional(),
  type: zPortainerSourceType.optional(),
  userAccesses: z.array(z.int()).optional(),
});

export const zPortainerUserResourceAccess = z.object({
  AccessLevel: zPortainerResourceAccessLevel.optional(),
  UserId: z.int().optional(),
});

export const zPortainerResourceControl = z.object({
  AccessLevel: zPortainerResourceAccessLevel.optional(),
  AdministratorsOnly: z.boolean().optional(),
  Id: z.int().optional(),
  OwnerId: z.int().optional(),
  Public: z.boolean().optional(),
  ResourceId: z.string().optional(),
  SubResourceIds: z.array(z.string()).optional(),
  System: z.boolean().optional(),
  TeamAccesses: z.array(zPortainerTeamResourceAccess).optional(),
  Type: zPortainerResourceControlType.optional(),
  UserAccesses: z.array(zPortainerUserResourceAccess).optional(),
});

export const zPortainerCustomTemplate = z.object({
  CreatedByUserId: z.int().optional(),
  Description: z.string().optional(),
  EdgeTemplate: z.boolean().optional(),
  EntryPoint: z.string().optional(),
  GitConfig: zGittypesRepoConfig.optional(),
  Id: z.int().optional(),
  IsComposeFormat: z.boolean().optional(),
  Logo: z.string().optional(),
  Note: z.string().optional(),
  Platform: z.union([z.literal(1), z.literal(2)]).optional(),
  ProjectPath: z.string().optional(),
  ResourceControl: zPortainerResourceControl.optional(),
  Title: z.string().optional(),
  Type: z.union([z.literal(1), z.literal(2), z.literal(3)]).optional(),
  Variables: z.array(zPortainerCustomTemplateVariableDefinition).optional(),
  artifact: zPortainerArtifact.optional(),
});

export const zPortainerStack = z.object({
  AdditionalFiles: z.array(z.string()).optional(),
  AutoUpdate: zPortainerAutoUpdateSettings.optional(),
  CreatedBy: z.string().optional(),
  CreationDate: z.int().optional(),
  CurrentDeploymentInfo: zPortainerStackDeploymentInfo.optional(),
  DeploymentStartStatus: zPortainerStackStatus.optional(),
  DeploymentStatus: z.array(zPortainerStackDeploymentStatus).optional(),
  EndpointId: z.int().optional(),
  EntryPoint: z.string().optional(),
  Env: z.array(zPortainerPair).optional(),
  FromAppTemplate: z.boolean().optional(),
  GitConfig: zGittypesRepoConfig.optional(),
  Id: z.int().optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  Option: zPortainerStackOption.optional(),
  ProjectPath: z.string().optional(),
  ResourceControl: zPortainerResourceControl.optional(),
  Status: zPortainerStackStatus.optional(),
  SwarmId: z.string().optional(),
  Type: zPortainerStackType.optional(),
  UpdateDate: z.int().optional(),
  UpdatedBy: z.string().optional(),
  WorkflowID: z.int().optional(),
});

export const zPortainerUserRole = z.union([
  z.literal(0),
  z.literal(1),
  z.literal(2),
]);

export const zPortainerUserThemeSettings = z.object({
  color: z.enum(['dark', 'light', 'highcontrast', 'auto', '']).optional(),
});

export const zPortainerUser = z.object({
  Id: z.int(),
  Role: zPortainerUserRole,
  ThemeSettings: zPortainerUserThemeSettings.optional(),
  TokenIssueAt: z.int().optional(),
  UseCache: z.boolean().optional(),
  Username: z.string(),
});

export const zPortainerWebhookType = z.union([z.literal(0), z.literal(1)]);

export const zPortainerWebhook = z.object({
  EndpointId: z.int().optional(),
  Id: z.int().optional(),
  RegistryId: z.int().optional(),
  ResourceId: z.string().optional(),
  Token: z.string().optional(),
  Type: zPortainerWebhookType.optional(),
});

export const zRegistriesRegistryConfigurePayload = z.object({
  Authentication: z.boolean(),
  Password: z.string().optional(),
  Region: z.string().optional(),
  TLS: z.boolean().optional(),
  TLSCACertFile: z
    .array(
      z
        .int()
        .min(-2147483648, {
          error: 'Invalid value: Expected int32 to be >= -2147483648',
        })
        .max(2147483647, {
          error: 'Invalid value: Expected int32 to be <= 2147483647',
        })
    )
    .optional(),
  TLSCertFile: z
    .array(
      z
        .int()
        .min(-2147483648, {
          error: 'Invalid value: Expected int32 to be >= -2147483648',
        })
        .max(2147483647, {
          error: 'Invalid value: Expected int32 to be <= 2147483647',
        })
    )
    .optional(),
  TLSKeyFile: z
    .array(
      z
        .int()
        .min(-2147483648, {
          error: 'Invalid value: Expected int32 to be >= -2147483648',
        })
        .max(2147483647, {
          error: 'Invalid value: Expected int32 to be <= 2147483647',
        })
    )
    .optional(),
  TLSSkipVerify: z.boolean().optional(),
  Username: z.string().optional(),
});

export const zRegistriesRegistryCreatePayload = z.object({
  Authentication: z.boolean(),
  BaseURL: z.string().optional(),
  Ecr: zPortainerEcrData.optional(),
  Gitlab: zPortainerGitlabRegistryData.optional(),
  Name: z.string(),
  Password: z.string().optional(),
  Quay: zPortainerQuayRegistryData.optional(),
  TLS: z.boolean().optional(),
  Type: z.union([
    z.literal(1),
    z.literal(2),
    z.literal(3),
    z.literal(4),
    z.literal(5),
    z.literal(6),
    z.literal(7),
  ]),
  URL: z.string(),
  Username: z.string().optional(),
});

export const zRegistriesRegistryPingPayload = z.object({
  Password: z.string().optional(),
  TLS: z.boolean().optional(),
  Type: z.union([
    z.literal(1),
    z.literal(2),
    z.literal(3),
    z.literal(4),
    z.literal(5),
    z.literal(6),
    z.literal(7),
    z.literal(8),
  ]),
  URL: z.string(),
  Username: z.string().optional(),
});

export const zRegistriesRegistryPingResponse = z.object({
  message: z.string().optional(),
  success: z.boolean().optional(),
});

export const zRegistriesRegistryUpdatePayload = z.object({
  Authentication: z.boolean(),
  BaseURL: z.string().optional(),
  Ecr: zPortainerEcrData.optional(),
  Name: z.string(),
  Password: z.string().optional(),
  Quay: zPortainerQuayRegistryData.optional(),
  RegistryAccesses: zPortainerRegistryAccesses.optional(),
  URL: z.string(),
  Username: z.string().optional(),
});

export const zReleaseChartReference = z.object({
  chartPath: z.string().optional(),
  registryID: z.int().optional(),
  repoURL: z.string().optional(),
});

export const zReleaseDependency = z.object({
  alias: z.string().optional(),
  condition: z.string().optional(),
  enabled: z.boolean().optional(),
  'import-values': z.array(z.unknown()).optional(),
  name: z.string().optional(),
  repository: z.string().optional(),
  tags: z.array(z.string()).optional(),
  version: z.string().optional(),
});

export const zReleaseFile = z.object({
  data: z.array(z.int()).optional(),
  name: z.string().optional(),
});

export const zReleaseHookExecution = z.object({
  completed_at: z.string().optional(),
  phase: z.string().optional(),
  started_at: z.string().optional(),
});

export const zGithubComPortainerPortainerPkgLibhelmReleaseHook = z.object({
  delete_policies: z.array(z.string()).optional(),
  events: z.array(z.string()).optional(),
  kind: z.string().optional(),
  last_run: zReleaseHookExecution.optional(),
  manifest: z.string().optional(),
  name: z.string().optional(),
  path: z.string().optional(),
  weight: z.int().optional(),
});

export const zReleaseLock = z.object({
  dependencies: z.array(zReleaseDependency).optional(),
  digest: z.string().optional(),
  generated: z.string().optional(),
});

export const zReleaseMaintainer = z.object({
  email: z.string().optional(),
  name: z.string().optional(),
  url: z.string().optional(),
});

export const zReleaseMetadata = z.object({
  annotations: z.record(z.string(), z.string()).optional(),
  apiVersion: z.string().optional(),
  appVersion: z.string().optional(),
  condition: z.string().optional(),
  dependencies: z.array(zReleaseDependency).optional(),
  deprecated: z.boolean().optional(),
  description: z.string().optional(),
  home: z.string().optional(),
  icon: z.string().optional(),
  keywords: z.array(z.string()).optional(),
  kubeVersion: z.string().optional(),
  maintainers: z.array(zReleaseMaintainer).optional(),
  name: z.string().optional(),
  sources: z.array(z.string()).optional(),
  tags: z.string().optional(),
  type: z.string().optional(),
  version: z.string().optional(),
});

export const zReleaseChart = z.object({
  files: z.array(zReleaseFile).optional(),
  lock: zReleaseLock.optional(),
  metadata: zReleaseMetadata.optional(),
  schema: z.array(z.int()).optional(),
  templates: z.array(zReleaseFile).optional(),
  values: z.record(z.string(), z.unknown()).optional(),
});

export const zReleaseReleaseElement = z.object({
  appVersion: z.string().optional(),
  chart: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  revision: z.string().optional(),
  status: z.string().optional(),
  updated: z.string().optional(),
});

export const zReleaseValues = z.object({
  computedValues: z.string().optional(),
  userSuppliedValues: z.string().optional(),
});

export const zResourceQuantity = z.object({
  Format: z.enum(['DecimalExponent', 'BinarySI', 'DecimalSI']).optional(),
});

export const zResourcecontrolsResourceControlCreatePayload = z.object({
  AdministratorsOnly: z.boolean().optional(),
  Public: z.boolean().optional(),
  ResourceID: z.string(),
  SubResourceIDs: z.array(z.string()).optional(),
  Teams: z.array(z.int()).optional(),
  Type: z.union([
    z.literal(1),
    z.literal(2),
    z.literal(3),
    z.literal(4),
    z.literal(5),
    z.literal(6),
    z.literal(7),
    z.literal(8),
    z.literal(9),
  ]),
  Users: z.array(z.int()).optional(),
});

export const zResourcecontrolsResourceControlUpdatePayload = z.object({
  AdministratorsOnly: z.boolean().optional(),
  Public: z.boolean().optional(),
  Teams: z.array(z.int()).optional(),
  Users: z.array(z.int()).optional(),
});

export const zRoarRoarPortainerEndpointId = z.record(z.string(), z.unknown());

export const zPortainerEdgeGroup = z.object({
  Dynamic: z.boolean().optional(),
  EndpointIds: zRoarRoarPortainerEndpointId.optional(),
  Endpoints: z.array(z.int()).optional(),
  Id: z.int().optional(),
  Name: z.string().optional(),
  PartialMatch: z.boolean().optional(),
  TagIds: z.array(z.int()).optional(),
});

export const zSettingsPublicSettingsResponse = z.object({
  AuthenticationMethod: zPortainerAuthenticationMethod.optional(),
  Edge: z
    .object({
      CheckinInterval: z.int().optional(),
      CommandInterval: z.int().optional(),
      PingInterval: z.int().optional(),
      SnapshotInterval: z.int().optional(),
    })
    .optional(),
  EnableEdgeComputeFeatures: z.boolean().optional(),
  Features: z.record(z.string(), z.boolean()).optional(),
  GlobalDeploymentOptions: zPortainerGlobalDeploymentOptions.optional(),
  IsDockerDesktopExtension: z.boolean().optional(),
  KubeconfigExpiry: z.string().optional().default('0'),
  LogoURL: z.string().optional(),
  OAuthLoginURI: z.string().optional(),
  OAuthLogoutURI: z.string().optional(),
  RequiredPasswordLength: z.int().optional(),
  RequiresSetupToken: z.boolean().optional(),
  TeamSync: z.boolean().optional(),
});

export const zSettingsSettingsUpdatePayload = z.object({
  AuthenticationMethod: z.int().optional(),
  BlackListedLabels: z.array(zPortainerPair).optional(),
  EdgeAgentCheckinInterval: z.int().optional(),
  EdgePortainerURL: z.string().optional(),
  EnableEdgeComputeFeatures: z.boolean().optional(),
  EnforceEdgeID: z.boolean().optional(),
  ForceSecureCookies: z.boolean().optional(),
  GlobalDeploymentOptions: zPortainerGlobalDeploymentOptions.optional(),
  HelmRepositoryURL: z.string().optional(),
  InternalAuthSettings: zPortainerInternalAuthSettings.optional(),
  KubeconfigExpiry: z.string().optional().default('0'),
  KubectlShellImage: z.string().optional(),
  LDAPSettings: zPortainerLdapSettings.optional(),
  LogoURL: z.string().optional(),
  OAuthSettings: zPortainerOAuthSettings.optional(),
  SnapshotInterval: z.string().optional(),
  TemplatesURL: z.string().optional(),
  TrustOnFirstConnect: z.boolean().optional(),
  UserSessionTimeout: z.string().optional(),
});

export const zSourcesAutoUpdateInfo = z.object({
  fetchInterval: z.string().optional(),
  mechanism: z.string().optional(),
});

export const zSourcesConnectionTestResult = z.object({
  error: z.string().optional(),
  success: z.boolean().optional(),
});

export const zSourcesGitAuthenticationPayload = z.object({
  password: z.string().optional(),
  username: z.string().optional(),
});

export const zSourcesGitAuthenticationUpdatePayload = z.object({
  password: z.string().optional(),
  username: z.string().optional(),
});

export const zSourcesGitSourceCreatePayload = z.object({
  administratorsOnly: z.boolean().optional(),
  authentication: zSourcesGitAuthenticationPayload.optional(),
  interval: z.string().optional(),
  name: z.string().optional(),
  public: z.boolean().optional(),
  teamAccesses: z.array(z.int()).optional(),
  tlsSkipVerify: z.boolean().optional(),
  url: z.string(),
  userAccesses: z.array(z.int()).optional(),
});

export const zSourcesGitSourceUpdatePayload = z.object({
  authentication: zSourcesGitAuthenticationUpdatePayload.optional(),
  interval: z.string().optional(),
  name: z.string().optional(),
  tlsSkipVerify: z.boolean().optional(),
  url: z.string().optional(),
});

export const zSourcesSourceAccess = z.object({
  public: z.boolean().optional(),
  teams: z.array(z.int()).optional(),
  users: z.array(z.int()).optional(),
});

export const zSourcesSourceAccessUpdatePayload = z.object({
  public: z.boolean().optional(),
  teams: z.array(z.int()).optional(),
  users: z.array(z.int()).optional(),
});

export const zSourcesSourceType = z.enum(['git', 'helm', 'oci']);

export const zSourcesStatus = z.enum(['unknown', 'healthy', 'error']);

export const zSourcesGitAuthInfo = z.object({
  username: z.string().optional(),
});

export const zSourcesConnectionInfo = z.object({
  authentication: zSourcesGitAuthInfo.optional(),
  tlsSkipVerify: z.boolean().optional(),
});

export const zSslSslUpdatePayload = z.object({
  Cert: z.string().optional(),
  HTTPEnabled: z.boolean().optional(),
  Key: z.string().optional(),
});

export const zStacksComposeStackFromFileContentPayload = z.object({
  Env: z.array(zPortainerPair).optional(),
  FromAppTemplate: z.boolean().optional(),
  Name: z.string(),
  StackFileContent: z.string(),
});

export const zStacksComposeStackFromGitRepositoryPayload = z.object({
  AdditionalFiles: z.array(z.string()).optional(),
  AutoUpdate: zPortainerAutoUpdateSettings.optional(),
  ComposeFile: z.string().optional().default('docker-compose.yml'),
  Env: z.array(zPortainerPair).optional(),
  FromAppTemplate: z.boolean().optional(),
  Name: z.string(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  SourceID: z.int().optional(),
  TLSSkipVerify: z.boolean().optional(),
});

export const zStacksKubernetesGitDeploymentPayload = z.object({
  AdditionalFiles: z.array(z.string()).optional(),
  AutoUpdate: zPortainerAutoUpdateSettings.optional(),
  ComposeFormat: z.boolean().optional(),
  ManifestFile: z.string().optional(),
  Namespace: z.string().optional(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  SourceID: z.int().optional(),
  StackName: z.string().optional(),
  TLSSkipVerify: z.boolean().optional(),
});

export const zStacksKubernetesManifestUrlDeploymentPayload = z.object({
  ComposeFormat: z.boolean().optional(),
  ManifestURL: z.string().optional(),
  Namespace: z.string().optional(),
  StackName: z.string().optional(),
});

export const zStacksKubernetesStringDeploymentPayload = z.object({
  ComposeFormat: z.boolean().optional(),
  FromAppTemplate: z.boolean().optional(),
  Namespace: z.string().optional(),
  StackFileContent: z.string().optional(),
  StackName: z.string().optional(),
});

export const zStacksStackFileResponse = z.object({
  StackFileContent: z.string().optional(),
});

export const zStacksStackGitRedeployPayload = z.object({
  Env: z.array(zPortainerPair).optional(),
  Prune: z.boolean().optional(),
  PullImage: z.boolean().optional(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  RepullImageAndRedeploy: z.boolean().optional(),
  StackName: z.string().optional(),
});

export const zStacksStackGitUpdatePayload = z.object({
  AdditionalFiles: z.array(z.string()).optional(),
  AutoUpdate: zPortainerAutoUpdateSettings.optional(),
  ConfigFilePath: z.string().optional(),
  Env: z.array(zPortainerPair).optional(),
  Prune: z.boolean().optional(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  SourceID: z.int().optional(),
  TLSSkipVerify: z.boolean().optional(),
});

export const zStacksStackMigratePayload = z.object({
  EndpointID: z.int(),
  Name: z.string().optional(),
  SwarmID: z.string().optional(),
});

export const zStacksStackResponse = z.object({
  AdditionalFiles: z.array(z.string()).optional(),
  AutoUpdate: zPortainerAutoUpdateSettings.optional(),
  CreatedBy: z.string().optional(),
  CreationDate: z.int().optional(),
  CurrentDeploymentInfo: zPortainerStackDeploymentInfo.optional(),
  DeploymentStartStatus: zPortainerStackStatus.optional(),
  DeploymentStatus: z.array(zPortainerStackDeploymentStatus).optional(),
  EndpointId: z.int().optional(),
  EntryPoint: z.string().optional(),
  Env: z.array(zPortainerPair).optional(),
  FromAppTemplate: z.boolean().optional(),
  GitConfig: zGittypesRepoConfig.optional(),
  GitSourceId: z.int().optional(),
  Id: z.int().optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  Option: zPortainerStackOption.optional(),
  ProjectPath: z.string().optional(),
  ResourceControl: zPortainerResourceControl.optional(),
  Status: zPortainerStackStatus.optional(),
  SwarmId: z.string().optional(),
  Type: zPortainerStackType.optional(),
  UpdateDate: z.int().optional(),
  UpdatedBy: z.string().optional(),
  WorkflowID: z.int().optional(),
});

export const zStacksSwarmStackFromFileContentPayload = z.object({
  Env: z.array(zPortainerPair).optional(),
  FromAppTemplate: z.boolean().optional(),
  Name: z.string(),
  StackFileContent: z.string(),
  SwarmID: z.string(),
});

export const zStacksSwarmStackFromGitRepositoryPayload = z.object({
  AdditionalFiles: z.array(z.string()).optional(),
  AutoUpdate: zPortainerAutoUpdateSettings.optional(),
  ComposeFile: z.string().optional().default('docker-compose.yml'),
  Env: z.array(zPortainerPair).optional(),
  FromAppTemplate: z.boolean().optional(),
  Name: z.string(),
  RepositoryAuthentication: z.boolean().optional(),
  RepositoryPassword: z.string().optional(),
  RepositoryReferenceName: z.string().optional(),
  RepositoryURL: z.string().optional(),
  RepositoryUsername: z.string().optional(),
  SourceID: z.int().optional(),
  SwarmID: z.string(),
  TLSSkipVerify: z.boolean().optional(),
});

export const zStacksUpdateSwarmStackPayload = z.object({
  Env: z.array(zPortainerPair).optional(),
  Prune: z.boolean().optional(),
  PullImage: z.boolean().optional(),
  RepullImageAndRedeploy: z.boolean().optional(),
  StackFileContent: z.string().optional(),
});

export const zStatsContainerStats = z.object({
  healthy: z.int().optional(),
  running: z.int().optional(),
  stopped: z.int().optional(),
  total: z.int().optional(),
  unhealthy: z.int().optional(),
});

export const zDockerDashboardResponse = z.object({
  containers: zStatsContainerStats.optional(),
  images: zDockerImagesCounters.optional(),
  networks: z.int().optional(),
  services: z.int().optional(),
  stacks: z.int().optional(),
  volumes: z.int().optional(),
});

export const zSwarmServiceUpdateResponse = z.object({
  Warnings: z.array(z.string()).optional(),
});

export const zSystemNodesCountResponse = z.object({
  nodes: z.int().optional(),
});

export const zSystemStatus = z.object({
  InstanceID: z.string().optional(),
  Version: z.string().optional(),
});

export const zSystemSystemInfoResponse = z.object({
  agents: z.int().optional(),
  edgeAgents: z.int().optional(),
  platform: zPlatformContainerPlatform.optional(),
});

export const zSystemVersionResponse = z.object({
  Build: zBuildBuildInfo.optional(),
  DatabaseVersion: z.string().optional(),
  Dependencies: zBuildDependenciesInfo.optional(),
  LatestVersion: z.string().optional(),
  Runtime: zBuildRuntimeInfo.optional(),
  ServerEdition: z.string().optional(),
  ServerVersion: z.string().optional(),
  UpdateAvailable: z.boolean().optional(),
  VersionSupport: z.string().optional(),
});

export const zTagsTagCreatePayload = z.object({
  Name: z.string(),
});

export const zTeammembershipsTeamMembershipCreatePayload = z.object({
  Role: z.union([z.literal(1), z.literal(2)]),
  TeamID: z.int(),
  UserID: z.int(),
});

export const zTeammembershipsTeamMembershipUpdatePayload = z.object({
  Role: z.union([z.literal(1), z.literal(2)]),
  TeamID: z.int(),
  UserID: z.int(),
});

export const zTeamsTeamCreatePayload = z.object({
  Name: z.string(),
  TeamLeaders: z.array(z.int()).optional(),
});

export const zTeamsTeamUpdatePayload = z.object({
  Name: z.string().optional(),
});

export const zTemplatesFileResponse = z.object({
  FileContent: z.string().optional(),
});

export const zTemplatesListResponse = z.object({
  templates: z.array(zPortainerTemplate).optional(),
  version: z.string().optional(),
});

export const zUnstructuredUnstructured = z.object({
  Object: z.record(z.string(), z.unknown()).optional(),
});

export const zReleaseInfo = z.object({
  deleted: z.string().optional(),
  description: z.string().optional(),
  first_deployed: z.string().optional(),
  last_deployed: z.string().optional(),
  notes: z.string().optional(),
  resources: z.array(zUnstructuredUnstructured).optional(),
  status: z.string().optional(),
});

export const zReleaseRelease = z.object({
  appVersion: z.string().optional(),
  chart: zReleaseChart.optional(),
  chartReference: zReleaseChartReference.optional(),
  config: z.record(z.string(), z.unknown()).optional(),
  hooks: z.array(zGithubComPortainerPortainerPkgLibhelmReleaseHook).optional(),
  info: zReleaseInfo.optional(),
  manifest: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  stackID: z.int().optional(),
  values: zReleaseValues.optional(),
  version: z.int().optional(),
});

export const zUsersAccessLocation = z.enum(['environment', 'environmentGroup']);

export const zUsersEffectiveAccessEntry = z.object({
  accessLocation: zUsersAccessLocation.optional(),
  endpointId: z.int().optional(),
  endpointName: z.string().optional(),
  groupId: z.int().optional(),
  groupName: z.string().optional(),
  roleId: z.int().optional(),
  roleName: z.string().optional(),
  rolePriority: z.int().optional(),
  teamId: z.int().optional(),
  teamName: z.string().optional(),
});

export const zUsersAccessTokenResponse = z.object({
  apiKey: zPortainerApiKey.optional(),
  rawAPIKey: z.string().optional(),
});

export const zUsersAddHelmRepoUrlPayload = z.object({
  url: z.string().optional(),
});

export const zUsersAdminInitPayload = z.object({
  Password: z.string(),
  Username: z.string(),
});

export const zUsersHelmUserRepositoryResponse = z.object({
  GlobalRepository: z.string().optional(),
  UserRepositories: z.array(zPortainerHelmUserRepository).optional(),
});

export const zUsersThemePayload = z.object({
  color: z.enum(['dark', 'light', 'highcontrast', 'auto']).optional(),
});

export const zUsersUserAccessTokenCreatePayload = z.object({
  description: z.string(),
  password: z.string(),
});

export const zUsersUserCreatePayload = z.object({
  Password: z.string(),
  Role: z.union([z.literal(1), z.literal(2)]),
  Username: z.string(),
});

export const zUsersUserUpdatePasswordPayload = z.object({
  NewPassword: z.string(),
  Password: z.string(),
});

export const zUsersUserUpdatePayload = z.object({
  NewPassword: z.string(),
  Password: z.string(),
  Role: z.union([z.literal(1), z.literal(2)]),
  Theme: zUsersThemePayload.optional(),
  UseCache: z.boolean(),
  Username: z.string(),
});

export const zV1AppArmorProfileType = z.enum([
  'Unconfined',
  'RuntimeDefault',
  'Localhost',
]);

export const zV1AppArmorProfile = z.object({
  localhostProfile: z.string().optional(),
  type: zV1AppArmorProfileType.optional(),
});

export const zV1AttachedVolume = z.object({
  devicePath: z.string().optional(),
  name: z.string().optional(),
});

export const zV1Capabilities = z.object({
  add: z.array(z.string()).optional(),
  drop: z.array(z.string()).optional(),
});

export const zV1ConfigMapEnvSource = z.object({
  name: z.string().optional(),
  optional: z.boolean().optional(),
});

export const zV1ConfigMapKeySelector = z.object({
  key: z.string().optional(),
  name: z.string().optional(),
  optional: z.boolean().optional(),
});

export const zV1ConfigMapNodeConfigSource = z.object({
  kubeletConfigKey: z.string().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  resourceVersion: z.string().optional(),
  uid: z.string().optional(),
});

export const zV1ContainerImage = z.object({
  names: z.array(z.string()).optional(),
  sizeBytes: z.int().optional(),
});

export const zV1ContainerRestartPolicy = z.enum([
  'Always',
  'Never',
  'OnFailure',
]);

export const zV1ContainerRestartRuleAction = z.enum([
  'Restart',
  'RestartAllContainers',
]);

export const zV1ContainerRestartRuleOnExitCodesOperator = z.enum([
  'In',
  'NotIn',
]);

export const zV1ContainerRestartRuleOnExitCodes = z.object({
  operator: zV1ContainerRestartRuleOnExitCodesOperator.optional(),
  values: z.array(z.int()).optional(),
});

export const zV1ContainerRestartRule = z.object({
  action: zV1ContainerRestartRuleAction.optional(),
  exitCodes: zV1ContainerRestartRuleOnExitCodes.optional(),
});

export const zV1DaemonEndpoint = z.object({
  Port: z.int().optional(),
});

export const zV1ExecAction = z.object({
  command: z.array(z.string()).optional(),
});

export const zV1FieldsV1 = z.record(z.string(), z.unknown());

export const zV1FileKeySelector = z.object({
  key: z.string().optional(),
  optional: z.boolean().optional(),
  path: z.string().optional(),
  volumeName: z.string().optional(),
});

export const zV1GrpcAction = z.object({
  port: z.int().optional(),
  service: z.string().optional(),
});

export const zV1ListMeta = z.object({
  continue: z.string().optional(),
  remainingItemCount: z.int().optional(),
  resourceVersion: z.string().optional(),
  selfLink: z.string().optional(),
});

export const zV1ManagedFieldsOperationType = z.enum(['Apply', 'Update']);

export const zV1ManagedFieldsEntry = z.object({
  apiVersion: z.string().optional(),
  fieldsType: z.string().optional(),
  fieldsV1: zV1FieldsV1.optional(),
  manager: z.string().optional(),
  operation: zV1ManagedFieldsOperationType.optional(),
  subresource: z.string().optional(),
  time: z.string().optional(),
});

export const zV1MountPropagationMode = z.enum([
  'None',
  'HostToContainer',
  'Bidirectional',
]);

export const zV1NamespaceConditionType = z.enum([
  'NamespaceDeletionDiscoveryFailure',
  'NamespaceDeletionContentFailure',
  'NamespaceDeletionGroupVersionParsingFailure',
  'NamespaceContentRemaining',
  'NamespaceFinalizersRemaining',
]);

export const zV1NamespaceCondition = z.object({
  lastTransitionTime: z.string().optional(),
  message: z.string().optional(),
  reason: z.string().optional(),
  status: zK8sIoApiCoreV1ConditionStatus.optional(),
  type: zV1NamespaceConditionType.optional(),
});

export const zV1NamespacePhase = z.enum(['Active', 'Terminating']);

export const zV1NamespaceStatus = z.object({
  conditions: z.array(zV1NamespaceCondition).optional(),
  phase: zV1NamespacePhase.optional(),
});

export const zV1NodeAddressType = z.enum([
  'Hostname',
  'InternalIP',
  'ExternalIP',
  'InternalDNS',
  'ExternalDNS',
]);

export const zV1NodeAddress = z.object({
  address: z.string().optional(),
  type: zV1NodeAddressType.optional(),
});

export const zV1NodeConditionType = z.enum([
  'Ready',
  'MemoryPressure',
  'DiskPressure',
  'PIDPressure',
  'NetworkUnavailable',
]);

export const zV1NodeCondition = z.object({
  lastHeartbeatTime: z.string().optional(),
  lastTransitionTime: z.string().optional(),
  message: z.string().optional(),
  reason: z.string().optional(),
  status: zK8sIoApiCoreV1ConditionStatus.optional(),
  type: zV1NodeConditionType.optional(),
});

export const zV1NodeConfigSource = z.object({
  configMap: zV1ConfigMapNodeConfigSource.optional(),
});

export const zV1NodeConfigStatus = z.object({
  active: zV1NodeConfigSource.optional(),
  assigned: zV1NodeConfigSource.optional(),
  error: z.string().optional(),
  lastKnownGood: zV1NodeConfigSource.optional(),
});

export const zV1NodeDaemonEndpoints = z.object({
  kubeletEndpoint: zV1DaemonEndpoint.optional(),
});

export const zV1NodeFeatures = z.object({
  supplementalGroupsPolicy: z.boolean().optional(),
});

export const zV1NodePhase = z.enum(['Pending', 'Running', 'Terminated']);

export const zV1NodeRuntimeHandlerFeatures = z.object({
  recursiveReadOnlyMounts: z.boolean().optional(),
  userNamespaces: z.boolean().optional(),
});

export const zV1NodeRuntimeHandler = z.object({
  features: zV1NodeRuntimeHandlerFeatures.optional(),
  name: z.string().optional(),
});

export const zV1NodeSwapStatus = z.object({
  capacity: z.int().optional(),
});

export const zV1NodeSystemInfo = z.object({
  architecture: z.string().optional(),
  bootID: z.string().optional(),
  containerRuntimeVersion: z.string().optional(),
  kernelVersion: z.string().optional(),
  kubeProxyVersion: z.string().optional(),
  kubeletVersion: z.string().optional(),
  machineID: z.string().optional(),
  operatingSystem: z.string().optional(),
  osImage: z.string().optional(),
  swap: zV1NodeSwapStatus.optional(),
  systemUUID: z.string().optional(),
});

export const zV1ObjectFieldSelector = z.object({
  apiVersion: z.string().optional(),
  fieldPath: z.string().optional(),
});

export const zV1OwnerReference = z.object({
  apiVersion: z.string().optional(),
  blockOwnerDeletion: z.boolean().optional(),
  controller: z.boolean().optional(),
  kind: z.string().optional(),
  name: z.string().optional(),
  uid: z.string().optional(),
});

export const zV1ObjectMeta = z.object({
  annotations: z.record(z.string(), z.string()).optional(),
  creationTimestamp: z.string().optional(),
  deletionGracePeriodSeconds: z.int().optional(),
  deletionTimestamp: z.string().optional(),
  finalizers: z.array(z.string()).optional(),
  generateName: z.string().optional(),
  generation: z.int().optional(),
  labels: z.record(z.string(), z.string()).optional(),
  managedFields: z.array(zV1ManagedFieldsEntry).optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  ownerReferences: z.array(zV1OwnerReference).optional(),
  resourceVersion: z.string().optional(),
  selfLink: z.string().optional(),
  uid: z.string().optional(),
});

export const zV1PersistentVolumeAccessMode = z.enum([
  'ReadWriteOnce',
  'ReadOnlyMany',
  'ReadWriteMany',
  'ReadWriteOncePod',
]);

export const zV1PersistentVolumeClaimPhase = z.enum([
  'Pending',
  'Bound',
  'Lost',
]);

export const zV1PersistentVolumeMode = z.enum(['Block', 'Filesystem']);

export const zV1PersistentVolumePhase = z.enum([
  'Pending',
  'Available',
  'Bound',
  'Released',
  'Failed',
]);

export const zV1PersistentVolumeReclaimPolicy = z.enum([
  'Recycle',
  'Delete',
  'Retain',
]);

export const zKubernetesK8sPvReclaimPolicyRequest = z.object({
  name: z.string().optional(),
  reclaimPolicy: zV1PersistentVolumeReclaimPolicy.optional(),
});

export const zKubernetesK8sStorageClass = z.object({
  allowVolumeExpansion: z.boolean().optional(),
  annotations: z.record(z.string(), z.string()).optional(),
  creationDate: z.string().optional(),
  isDefault: z.boolean().optional(),
  labels: z.record(z.string(), z.string()).optional(),
  mountOptions: z.array(z.string()).optional(),
  name: z.string().optional(),
  parameters: z.record(z.string(), z.string()).optional(),
  provisioner: z.string().optional(),
  reclaimPolicy: zV1PersistentVolumeReclaimPolicy.optional(),
});

export const zV1ProcMountType = z.enum(['Default', 'Unmasked']);

export const zV1Protocol = z.enum(['TCP', 'UDP', 'SCTP']);

export const zV1ContainerPort = z.object({
  containerPort: z.int().optional(),
  hostIP: z.string().optional(),
  hostPort: z.int().optional(),
  name: z.string().optional(),
  protocol: zV1Protocol.optional(),
});

export const zV1PullPolicy = z.enum(['Always', 'Never', 'IfNotPresent']);

export const zV1RecursiveReadOnlyMode = z.enum([
  'Disabled',
  'IfPossible',
  'Enabled',
]);

export const zV1ResourceFieldSelector = z.object({
  containerName: z.string().optional(),
  divisor: zResourceQuantity.optional(),
  resource: z.string().optional(),
});

export const zV1ResourceList = z.record(z.string(), zResourceQuantity);

export const zKubernetesK8sPersistentVolumeClaim = z.object({
  accessModes: z.array(z.string()).optional(),
  allowVolumeExpansion: z.boolean().optional(),
  creationDate: z.string().optional(),
  humanReadableAccessModes: z.array(zV1PersistentVolumeAccessMode).optional(),
  id: z.string().optional(),
  labels: z.record(z.string(), z.string()).optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  owningApplications: z.array(zKubernetesK8sApplication).optional(),
  phase: zV1PersistentVolumeClaimPhase.optional(),
  resourcesRequests: zV1ResourceList.optional(),
  storage: z.int().optional(),
  storageClass: z.string().optional(),
  storageRequest: z.string().optional(),
  volumeMode: zV1PersistentVolumeMode.optional(),
  volumeName: z.string().optional(),
});

export const zV1NodeStatus = z.object({
  addresses: z.array(zV1NodeAddress).optional(),
  allocatable: zV1ResourceList.optional(),
  capacity: zV1ResourceList.optional(),
  conditions: z.array(zV1NodeCondition).optional(),
  config: zV1NodeConfigStatus.optional(),
  daemonEndpoints: zV1NodeDaemonEndpoints.optional(),
  declaredFeatures: z.array(z.string()).optional(),
  features: zV1NodeFeatures.optional(),
  images: z.array(zV1ContainerImage).optional(),
  nodeInfo: zV1NodeSystemInfo.optional(),
  phase: zV1NodePhase.optional(),
  runtimeHandlers: z.array(zV1NodeRuntimeHandler).optional(),
  volumesAttached: z.array(zV1AttachedVolume).optional(),
  volumesInUse: z.array(z.string()).optional(),
});

export const zV1ResourceName = z.enum([
  'cpu',
  'memory',
  'storage',
  'ephemeral-storage',
  'pods',
  'services',
  'replicationcontrollers',
  'resourcequotas',
  'secrets',
  'configmaps',
  'persistentvolumeclaims',
  'services.nodeports',
  'services.loadbalancers',
  'requests.cpu',
  'requests.memory',
  'requests.storage',
  'requests.ephemeral-storage',
  'limits.cpu',
  'limits.memory',
  'limits.ephemeral-storage',
]);

export const zV1ResourceQuotaScope = z.enum([
  'Terminating',
  'NotTerminating',
  'BestEffort',
  'NotBestEffort',
  'PriorityClass',
  'CrossNamespacePodAffinity',
  'VolumeAttributesClass',
]);

export const zV1ResourceQuotaStatus = z.object({
  hard: zV1ResourceList.optional(),
  used: zV1ResourceList.optional(),
});

export const zV1ResourceRequirements = z.object({
  claims: z.array(zK8sIoApiCoreV1ResourceClaim).optional(),
  limits: zV1ResourceList.optional(),
  requests: zV1ResourceList.optional(),
});

export const zV1ResourceResizeRestartPolicy = z.enum([
  'NotRequired',
  'RestartContainer',
]);

export const zV1ContainerResizePolicy = z.object({
  resourceName: zV1ResourceName.optional(),
  restartPolicy: zV1ResourceResizeRestartPolicy.optional(),
});

export const zV1RoleRef = z.object({
  apiGroup: z.string().optional(),
  kind: z.string().optional(),
  name: z.string().optional(),
});

export const zKubernetesK8sClusterRoleBinding = z.object({
  creationDate: z.string().optional(),
  isSystem: z.boolean().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  roleRef: zV1RoleRef.optional(),
  subjects: z.array(zK8sIoApiRbacV1Subject).optional(),
  uid: z.string().optional(),
});

export const zKubernetesK8sRoleBinding = z.object({
  creationDate: z.string().optional(),
  isSystem: z.boolean().optional(),
  name: z.string().optional(),
  namespace: z.string().optional(),
  roleRef: zV1RoleRef.optional(),
  subjects: z.array(zK8sIoApiRbacV1Subject).optional(),
  uid: z.string().optional(),
});

export const zV1SeLinuxOptions = z.object({
  level: z.string().optional(),
  role: z.string().optional(),
  type: z.string().optional(),
  user: z.string().optional(),
});

export const zV1ScopeSelectorOperator = z.enum([
  'In',
  'NotIn',
  'Exists',
  'DoesNotExist',
]);

export const zV1ScopedResourceSelectorRequirement = z.object({
  operator: zV1ScopeSelectorOperator.optional(),
  scopeName: zV1ResourceQuotaScope.optional(),
  values: z.array(z.string()).optional(),
});

export const zV1ScopeSelector = z.object({
  matchExpressions: z.array(zV1ScopedResourceSelectorRequirement).optional(),
});

export const zV1ResourceQuotaSpec = z.object({
  hard: zV1ResourceList.optional(),
  scopeSelector: zV1ScopeSelector.optional(),
  scopes: z.array(zV1ResourceQuotaScope).optional(),
});

export const zV1ResourceQuota = z.object({
  apiVersion: z.string().optional(),
  kind: z.string().optional(),
  metadata: zV1ObjectMeta.optional(),
  spec: zV1ResourceQuotaSpec.optional(),
  status: zV1ResourceQuotaStatus.optional(),
});

export const zPortainerK8sNamespaceInfo = z.object({
  Annotations: z.record(z.string(), z.string()).optional(),
  CreationDate: z.string().optional(),
  Id: z.string().optional(),
  IsDefault: z.boolean().optional(),
  IsSystem: z.boolean().optional(),
  Name: z.string().optional(),
  NamespaceOwner: z.string().optional(),
  ResourceQuota: zV1ResourceQuota.optional(),
  Status: zV1NamespaceStatus.optional(),
  UnhealthyEventCount: z.int().optional(),
});

export const zV1SeccompProfileType = z.enum([
  'Unconfined',
  'RuntimeDefault',
  'Localhost',
]);

export const zV1SeccompProfile = z.object({
  localhostProfile: z.string().optional(),
  type: zV1SeccompProfileType.optional(),
});

export const zV1SecretEnvSource = z.object({
  name: z.string().optional(),
  optional: z.boolean().optional(),
});

export const zV1EnvFromSource = z.object({
  configMapRef: zV1ConfigMapEnvSource.optional(),
  prefix: z.string().optional(),
  secretRef: zV1SecretEnvSource.optional(),
});

export const zV1SecretKeySelector = z.object({
  key: z.string().optional(),
  name: z.string().optional(),
  optional: z.boolean().optional(),
});

export const zV1EnvVarSource = z.object({
  configMapKeyRef: zV1ConfigMapKeySelector.optional(),
  fieldRef: zV1ObjectFieldSelector.optional(),
  fileKeyRef: zV1FileKeySelector.optional(),
  resourceFieldRef: zV1ResourceFieldSelector.optional(),
  secretKeyRef: zV1SecretKeySelector.optional(),
});

export const zV1EnvVar = z.object({
  name: z.string().optional(),
  value: z.string().optional(),
  valueFrom: zV1EnvVarSource.optional(),
});

export const zV1SecretReference = z.object({
  name: z.string().optional(),
  namespace: z.string().optional(),
});

export const zV1CsiPersistentVolumeSource = z.object({
  controllerExpandSecretRef: zV1SecretReference.optional(),
  controllerPublishSecretRef: zV1SecretReference.optional(),
  driver: z.string().optional(),
  fsType: z.string().optional(),
  nodeExpandSecretRef: zV1SecretReference.optional(),
  nodePublishSecretRef: zV1SecretReference.optional(),
  nodeStageSecretRef: zV1SecretReference.optional(),
  readOnly: z.boolean().optional(),
  volumeAttributes: z.record(z.string(), z.string()).optional(),
  volumeHandle: z.string().optional(),
});

export const zKubernetesK8sPersistentVolume = z.object({
  accessModes: z.array(z.string()).optional(),
  annotations: z.record(z.string(), z.string()).optional(),
  capacity: zV1ResourceList.optional(),
  claimRef: zK8sIoApiCoreV1ObjectReference.optional(),
  creationDate: z.string().optional(),
  csi: zV1CsiPersistentVolumeSource.optional(),
  humanReadableAccessModes: z.array(zV1PersistentVolumeAccessMode).optional(),
  labels: z.record(z.string(), z.string()).optional(),
  name: z.string().optional(),
  persistentVolumeReclaimPolicy: zV1PersistentVolumeReclaimPolicy.optional(),
  status: zV1PersistentVolumePhase.optional(),
  storageClassName: z.string().optional(),
  volumeMode: zV1PersistentVolumeMode.optional(),
});

export const zKubernetesK8sVolumeInfo = z.object({
  persistentVolume: zKubernetesK8sPersistentVolume.optional(),
  persistentVolumeClaim: zKubernetesK8sPersistentVolumeClaim.optional(),
  storageClass: zKubernetesK8sStorageClass.optional(),
});

export const zV1Signal = z.enum([
  'SIGABRT',
  'SIGALRM',
  'SIGBUS',
  'SIGCHLD',
  'SIGCLD',
  'SIGCONT',
  'SIGFPE',
  'SIGHUP',
  'SIGILL',
  'SIGINT',
  'SIGIO',
  'SIGIOT',
  'SIGKILL',
  'SIGPIPE',
  'SIGPOLL',
  'SIGPROF',
  'SIGPWR',
  'SIGQUIT',
  'SIGSEGV',
  'SIGSTKFLT',
  'SIGSTOP',
  'SIGSYS',
  'SIGTERM',
  'SIGTRAP',
  'SIGTSTP',
  'SIGTTIN',
  'SIGTTOU',
  'SIGURG',
  'SIGUSR1',
  'SIGUSR2',
  'SIGVTALRM',
  'SIGWINCH',
  'SIGXCPU',
  'SIGXFSZ',
  'SIGRTMIN',
  'SIGRTMIN+1',
  'SIGRTMIN+2',
  'SIGRTMIN+3',
  'SIGRTMIN+4',
  'SIGRTMIN+5',
  'SIGRTMIN+6',
  'SIGRTMIN+7',
  'SIGRTMIN+8',
  'SIGRTMIN+9',
  'SIGRTMIN+10',
  'SIGRTMIN+11',
  'SIGRTMIN+12',
  'SIGRTMIN+13',
  'SIGRTMIN+14',
  'SIGRTMIN+15',
  'SIGRTMAX-14',
  'SIGRTMAX-13',
  'SIGRTMAX-12',
  'SIGRTMAX-11',
  'SIGRTMAX-10',
  'SIGRTMAX-9',
  'SIGRTMAX-8',
  'SIGRTMAX-7',
  'SIGRTMAX-6',
  'SIGRTMAX-5',
  'SIGRTMAX-4',
  'SIGRTMAX-3',
  'SIGRTMAX-2',
  'SIGRTMAX-1',
  'SIGRTMAX',
]);

export const zV1SleepAction = z.object({
  seconds: z.int().optional(),
});

export const zV1TcpSocketAction = z.object({
  host: z.string().optional(),
  port: zIntstrIntOrString.optional(),
});

export const zV1TaintEffect = z.enum([
  'NoSchedule',
  'PreferNoSchedule',
  'NoExecute',
]);

export const zV1Taint = z.object({
  effect: zV1TaintEffect.optional(),
  key: z.string().optional(),
  timeAdded: z.string().optional(),
  value: z.string().optional(),
});

export const zV1NodeSpec = z.object({
  configSource: zV1NodeConfigSource.optional(),
  externalID: z.string().optional(),
  podCIDR: z.string().optional(),
  podCIDRs: z.array(z.string()).optional(),
  providerID: z.string().optional(),
  taints: z.array(zV1Taint).optional(),
  unschedulable: z.boolean().optional(),
});

export const zKubernetesKubernetesNodeResponse = z.object({
  apiVersion: z.string().optional(),
  kind: z.string().optional(),
  metadata: zV1ObjectMeta.optional(),
  spec: zV1NodeSpec.optional(),
  status: zV1NodeStatus.optional(),
});

export const zV1TerminationMessagePolicy = z.enum([
  'File',
  'FallbackToLogsOnError',
]);

export const zV1UriScheme = z.enum(['HTTP', 'HTTPS']);

export const zV1HttpGetAction = z.object({
  host: z.string().optional(),
  httpHeaders: z.array(zK8sIoApiCoreV1HttpHeader).optional(),
  path: z.string().optional(),
  port: zIntstrIntOrString.optional(),
  scheme: zV1UriScheme.optional(),
});

export const zV1LifecycleHandler = z.object({
  exec: zV1ExecAction.optional(),
  httpGet: zV1HttpGetAction.optional(),
  sleep: zV1SleepAction.optional(),
  tcpSocket: zV1TcpSocketAction.optional(),
});

export const zV1Lifecycle = z.object({
  postStart: zV1LifecycleHandler.optional(),
  preStop: zV1LifecycleHandler.optional(),
  stopSignal: zV1Signal.optional(),
});

export const zV1Probe = z.object({
  exec: zV1ExecAction.optional(),
  failureThreshold: z.int().optional(),
  grpc: zV1GrpcAction.optional(),
  httpGet: zV1HttpGetAction.optional(),
  initialDelaySeconds: z.int().optional(),
  periodSeconds: z.int().optional(),
  successThreshold: z.int().optional(),
  tcpSocket: zV1TcpSocketAction.optional(),
  terminationGracePeriodSeconds: z.int().optional(),
  timeoutSeconds: z.int().optional(),
});

export const zV1VolumeDevice = z.object({
  devicePath: z.string().optional(),
  name: z.string().optional(),
});

export const zV1VolumeMount = z.object({
  mountPath: z.string().optional(),
  mountPropagation: zV1MountPropagationMode.optional(),
  name: z.string().optional(),
  readOnly: z.boolean().optional(),
  recursiveReadOnly: zV1RecursiveReadOnlyMode.optional(),
  subPath: z.string().optional(),
  subPathExpr: z.string().optional(),
});

export const zV1WindowsSecurityContextOptions = z.object({
  gmsaCredentialSpec: z.string().optional(),
  gmsaCredentialSpecName: z.string().optional(),
  hostProcess: z.boolean().optional(),
  runAsUserName: z.string().optional(),
});

export const zV1SecurityContext = z.object({
  allowPrivilegeEscalation: z.boolean().optional(),
  appArmorProfile: zV1AppArmorProfile.optional(),
  capabilities: zV1Capabilities.optional(),
  privileged: z.boolean().optional(),
  procMount: zV1ProcMountType.optional(),
  readOnlyRootFilesystem: z.boolean().optional(),
  runAsGroup: z.int().optional(),
  runAsNonRoot: z.boolean().optional(),
  runAsUser: z.int().optional(),
  seLinuxOptions: zV1SeLinuxOptions.optional(),
  seccompProfile: zV1SeccompProfile.optional(),
  windowsOptions: zV1WindowsSecurityContextOptions.optional(),
});

export const zV1Container = z.object({
  args: z.array(z.string()).optional(),
  command: z.array(z.string()).optional(),
  env: z.array(zV1EnvVar).optional(),
  envFrom: z.array(zV1EnvFromSource).optional(),
  image: z.string().optional(),
  imagePullPolicy: zV1PullPolicy.optional(),
  lifecycle: zV1Lifecycle.optional(),
  livenessProbe: zV1Probe.optional(),
  name: z.string().optional(),
  ports: z.array(zV1ContainerPort).optional(),
  readinessProbe: zV1Probe.optional(),
  resizePolicy: z.array(zV1ContainerResizePolicy).optional(),
  resources: zV1ResourceRequirements.optional(),
  restartPolicy: zV1ContainerRestartPolicy.optional(),
  restartPolicyRules: z.array(zV1ContainerRestartRule).optional(),
  securityContext: zV1SecurityContext.optional(),
  startupProbe: zV1Probe.optional(),
  stdin: z.boolean().optional(),
  stdinOnce: z.boolean().optional(),
  terminationMessagePath: z.string().optional(),
  terminationMessagePolicy: zV1TerminationMessagePolicy.optional(),
  tty: z.boolean().optional(),
  volumeDevices: z.array(zV1VolumeDevice).optional(),
  volumeMounts: z.array(zV1VolumeMount).optional(),
  workingDir: z.string().optional(),
});

export const zKubernetesK8sJob = z.object({
  BackoffLimit: z.int().optional(),
  Command: z.string().optional(),
  Completions: z.int().optional(),
  Container: zV1Container.optional(),
  Duration: z.string().optional(),
  FailedReason: z.string().optional(),
  FinishTime: z.string().optional(),
  Id: z.string().optional(),
  IsSystem: z.boolean().optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  PodName: z.string().optional(),
  StartTime: z.string().optional(),
  Status: z.string().optional(),
});

export const zKubernetesK8sCronJob = z.object({
  Command: z.string().optional(),
  Id: z.string().optional(),
  IsSystem: z.boolean().optional(),
  Jobs: z.array(zKubernetesK8sJob).optional(),
  Name: z.string().optional(),
  Namespace: z.string().optional(),
  Schedule: z.string().optional(),
  Suspend: z.boolean().optional(),
  Timezone: z.string().optional(),
});

export const zV1Beta1ContainerMetrics = z.object({
  name: z.string().optional(),
  usage: zV1ResourceList.optional(),
});

export const zV1Beta1NodeMetrics = z.object({
  apiVersion: z.string().optional(),
  kind: z.string().optional(),
  metadata: zV1ObjectMeta.optional(),
  timestamp: z.string().optional(),
  usage: zV1ResourceList.optional(),
  window: z.string().optional(),
});

export const zV1Beta1NodeMetricsList = z.object({
  apiVersion: z.string().optional(),
  items: z.array(zV1Beta1NodeMetrics).optional(),
  kind: z.string().optional(),
  metadata: zV1ListMeta.optional(),
});

export const zV1Beta1PodMetrics = z.object({
  apiVersion: z.string().optional(),
  containers: z.array(zV1Beta1ContainerMetrics).optional(),
  kind: z.string().optional(),
  metadata: zV1ObjectMeta.optional(),
  timestamp: z.string().optional(),
  window: z.string().optional(),
});

export const zV1Beta1PodMetricsList = z.object({
  apiVersion: z.string().optional(),
  items: z.array(zV1Beta1PodMetrics).optional(),
  kind: z.string().optional(),
  metadata: zV1ListMeta.optional(),
});

export const zWebhooksWebhookCreatePayload = z.object({
  EndpointID: z.int().optional(),
  RegistryID: z.int().optional(),
  ResourceID: z.string().optional(),
  WebhookType: zPortainerWebhookType.optional(),
});

export const zWebhooksWebhookUpdatePayload = z.object({
  RegistryID: z.int().optional(),
});

export const zWorkflowsArtifactFileDetail = z.object({
  hash: z.string().optional(),
  path: z.string().optional(),
  pathError: z.string().optional(),
  pathStatus: zSourcesStatus.optional(),
  ref: z.string().optional(),
  refError: z.string().optional(),
  refStatus: zSourcesStatus.optional(),
  sourceId: z.int().optional(),
});

export const zWorkflowsDeploymentPlatform = z.enum([
  'dockerStandalone',
  'dockerSwarm',
  'kubernetes',
]);

export const zWorkflowsStatus = z.enum([
  'healthy',
  'syncing',
  'error',
  'paused',
  'unknown',
]);

export const zSourcesSource = z.object({
  environments: z.int().optional(),
  error: z.string().optional(),
  id: z.int(),
  interval: z.string().optional(),
  lastSync: z.int().optional(),
  name: z.string(),
  status: zWorkflowsStatus,
  type: zSourcesSourceType,
  url: z.string(),
  usedBy: z.int().optional(),
});

export const zWorkflowsStatusSummary = z.object({
  error: z.int().optional(),
  healthy: z.int().optional(),
  paused: z.int().optional(),
  syncing: z.int().optional(),
  unknown: z.int().optional(),
});

export const zWorkflowsTarget = z.object({
  edgeGroupIds: z.array(z.int()).optional(),
  endpointId: z.int().optional(),
  groupStatus: z.record(z.string(), zWorkflowsStatus).optional(),
  namespace: z.string().optional(),
  resolvedEndpointIds: z.array(z.int()).optional(),
});

export const zWorkflowsType = z.enum(['stack', 'edgeStack']);

export const zWorkflowsWorkflowPhaseStatus = z.object({
  error: z.string().optional(),
  status: zWorkflowsStatus.optional(),
});

export const zWorkflowsWorkflowStatusObject = z.object({
  artifact: zWorkflowsWorkflowPhaseStatus.optional(),
  source: zWorkflowsWorkflowPhaseStatus.optional(),
  target: zWorkflowsWorkflowPhaseStatus.optional(),
});

export const zWorkflowsArtifactDetail = z.object({
  autoUpdate: zPortainerAutoUpdateSettings.optional(),
  creationDate: z.int().optional(),
  files: z.array(zWorkflowsArtifactFileDetail).optional(),
  id: z.int(),
  lastSyncDate: z.int().optional(),
  name: z.string(),
  platform: zWorkflowsDeploymentPlatform.optional(),
  status: zWorkflowsWorkflowStatusObject.optional(),
  target: zWorkflowsTarget.optional(),
  type: zWorkflowsType,
});

export const zWorkflowsSourceWorkflow = z.object({
  autoUpdate: zPortainerAutoUpdateSettings.optional(),
  creationDate: z.int().optional(),
  gitConfig: zGittypesRepoConfig.optional(),
  id: z.int(),
  lastSyncDate: z.int().optional(),
  name: z.string(),
  platform: zWorkflowsDeploymentPlatform,
  sourceId: z.int().optional(),
  status: zWorkflowsWorkflowStatusObject,
  target: zWorkflowsTarget,
  type: zWorkflowsType,
});

export const zSourcesSourceDetail = z.object({
  access: zSourcesSourceAccess.optional(),
  autoUpdate: zSourcesAutoUpdateInfo.optional(),
  connection: zSourcesConnectionInfo,
  environments: z.int().optional(),
  error: z.string().optional(),
  id: z.int(),
  interval: z.string().optional(),
  lastSync: z.int().optional(),
  name: z.string(),
  status: zWorkflowsStatus,
  type: zSourcesSourceType,
  url: z.string(),
  usedBy: z.int().optional(),
  workflows: z.array(zWorkflowsSourceWorkflow).optional(),
});

export const zWorkflowsWorkflow = z.object({
  artifacts: z.array(zWorkflowsArtifactDetail).optional(),
  creationDate: z.int().optional(),
  id: z.int(),
  lastSyncDate: z.int().optional(),
  name: z.string(),
  status: zWorkflowsWorkflowStatusObject,
});

/**
 * Ingress controllers
 */
export const zKubernetesK8sIngressControllerArray = z.array(
  zKubernetesK8sIngressController
);

export const zEndpointsEndpointDeleteBatchPayload2 =
  zEndpointsEndpointDeleteBatchPayload;

export const zKubernetesK8sNamespaceDetails2 = zKubernetesK8sNamespaceDetails;

export const zKubernetesK8sIngressInfo2 = zKubernetesK8sIngressInfo;

export const zKubernetesK8sServiceInfo2 = zKubernetesK8sServiceInfo;

/**
 * Credentials used for authentication
 */
export const zAuthenticateUserBody = zAuthAuthenticatePayload;

/**
 * Success
 */
export const zAuthenticateUserResponse = zAuthAuthenticateResponse;

/**
 * Success
 */
export const zLogoutResponse = z.void();

/**
 * OAuth Credentials used for authentication
 */
export const zValidateOAuthBody = zAuthOauthPayload;

/**
 * Success
 */
export const zValidateOAuthResponse = zAuthAuthenticateResponse;

/**
 * An object contains the password to encrypt the backup with
 */
export const zBackupBody = zBackupBackupPayload;

export const zCustomTemplateListQuery = z.object({
  type: z.array(z.union([z.literal(1), z.literal(2), z.literal(3)])),
  edge: z.boolean().optional(),
});

/**
 * Success
 */
export const zCustomTemplateListResponse = z.array(zPortainerCustomTemplate);

export const zCustomTemplateDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zCustomTemplateDeleteResponse = z.void();

export const zCustomTemplateInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zCustomTemplateInspectResponse = zPortainerCustomTemplate;

/**
 * Template details
 */
export const zCustomTemplateUpdateBody =
  zCustomtemplatesCustomTemplateUpdatePayload;

export const zCustomTemplateUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zCustomTemplateUpdateResponse = zPortainerCustomTemplate;

export const zCustomTemplateFilePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zCustomTemplateFileResponse = zCustomtemplatesFileResponse;

export const zCustomTemplateGitFetchPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zCustomTemplateGitFetchResponse = zCustomtemplatesFileResponse;

export const zCustomTemplateCreateFileBody = z.object({
  Title: z.string(),
  Description: z.string(),
  Note: z.string(),
  Platform: z.union([z.literal(1), z.literal(2)]),
  Type: z.union([z.literal(1), z.literal(2), z.literal(3)]),
  File: z.union([z.instanceof(Blob), z.instanceof(File)]),
  Logo: z.string().optional(),
  Variables: z.string().optional(),
});

/**
 * OK
 */
export const zCustomTemplateCreateFileResponse = zPortainerCustomTemplate;

/**
 * Required when using method=repository
 */
export const zCustomTemplateCreateRepositoryBody =
  zCustomtemplatesCustomTemplateFromGitRepositoryPayload;

/**
 * OK
 */
export const zCustomTemplateCreateRepositoryResponse = zPortainerCustomTemplate;

/**
 * body
 */
export const zCustomTemplateCreateStringBody =
  zCustomtemplatesCustomTemplateFromFileContentPayload;

/**
 * OK
 */
export const zCustomTemplateCreateStringResponse = zPortainerCustomTemplate;

export const zDockerContainerGpusInspectPath = z.object({
  environmentId: z.int(),
  containerId: z.int(),
});

/**
 * Success
 */
export const zDockerContainerGpusInspectResponse =
  zContainersContainerGpusResponse;

export const zDockerDashboardPath = z.object({
  environmentId: z.int(),
});

/**
 * Success
 */
export const zDockerDashboardResponse2 = zDockerDashboardResponse;

export const zDockerImagesListPath = z.object({
  environmentId: z.int(),
});

export const zDockerImagesListQuery = z.object({
  withUsage: z.boolean().optional(),
});

/**
 * Success
 */
export const zDockerImagesListResponse = z.array(zImagesImageResponse);

/**
 * EdgeGroups
 */
export const zEdgeGroupListResponse = z.array(zEdgegroupsDecoratedEdgeGroup);

/**
 * EdgeGroup data
 */
export const zEdgeGroupCreateBody = zEdgegroupsEdgeGroupCreatePayload;

/**
 * OK
 */
export const zEdgeGroupCreateResponse = zPortainerEdgeGroup;

export const zEdgeGroupDeletePath = z.object({
  id: z.int(),
});

/**
 * No Content
 */
export const zEdgeGroupDeleteResponse = z.void();

export const zEdgeGroupInspectPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeGroupInspectResponse = zPortainerEdgeGroup;

/**
 * EdgeGroup data
 */
export const zEdgeGroupUpdateBody = zEdgegroupsEdgeGroupUpdatePayload;

export const zEdgeGroupUpdatePath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeGroupUpdateResponse = zPortainerEdgeGroup;

/**
 * OK
 */
export const zEdgeJobListResponse = z.array(zPortainerEdgeJob);

export const zEdgeJobDeletePath = z.object({
  id: z.int(),
});

/**
 * No Content
 */
export const zEdgeJobDeleteResponse = z.void();

export const zEdgeJobInspectPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeJobInspectResponse = zPortainerEdgeJob;

/**
 * EdgeGroup data
 */
export const zEdgeJobUpdateBody = zEdgejobsEdgeJobUpdatePayload;

export const zEdgeJobUpdatePath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeJobUpdateResponse = zPortainerEdgeJob;

export const zEdgeJobFilePath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeJobFileResponse = zEdgejobsEdgeJobFileResponse;

export const zEdgeJobTasksListPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeJobTasksListResponse = z.array(zEdgejobsTaskContainer);

export const zEdgeJobTasksClearPath = z.object({
  id: z.int(),
  taskID: z.int(),
});

/**
 * No Content
 */
export const zEdgeJobTasksClearResponse = z.void();

export const zEdgeJobTaskLogsInspectPath = z.object({
  id: z.int(),
  taskID: z.int(),
});

/**
 * OK
 */
export const zEdgeJobTaskLogsInspectResponse = zEdgejobsFileResponse;

export const zEdgeJobTasksCollectPath = z.object({
  id: z.int(),
  taskID: z.int(),
});

/**
 * No Content
 */
export const zEdgeJobTasksCollectResponse = z.void();

export const zEdgeJobCreateFileBody = z.object({
  file: z.union([z.instanceof(Blob), z.instanceof(File)]),
  Name: z.string(),
  CronExpression: z.string(),
  EdgeGroups: z.string(),
  Endpoints: z.string(),
  Recurring: z.boolean().optional(),
});

/**
 * OK
 */
export const zEdgeJobCreateFileResponse = zPortainerEdgeGroup;

/**
 * EdgeGroup data when method is string
 */
export const zEdgeJobCreateStringBody =
  zEdgejobsEdgeJobCreateFromFileContentPayload;

/**
 * OK
 */
export const zEdgeJobCreateStringResponse = zPortainerEdgeGroup;

export const zEdgeStackListQuery = z.object({
  summarizeStatuses: z.boolean().optional(),
});

/**
 * OK
 */
export const zEdgeStackListResponse = z.array(zPortainerEdgeStack);

export const zEdgeStackDeletePath = z.object({
  id: z.int(),
});

/**
 * No Content
 */
export const zEdgeStackDeleteResponse = z.void();

export const zEdgeStackInspectPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeStackInspectResponse = zPortainerEdgeStack;

/**
 * EdgeStack data
 */
export const zEdgeStackUpdateBody = zEdgestacksUpdateEdgeStackPayload;

export const zEdgeStackUpdatePath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeStackUpdateResponse = zPortainerEdgeStack;

export const zEdgeStackFilePath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeStackFileResponse = zEdgestacksStackFileResponse;

/**
 * EdgeStack status payload
 */
export const zEdgeStackStatusUpdateBody = zEdgestacksUpdateStatusPayload;

export const zEdgeStackStatusUpdatePath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zEdgeStackStatusUpdateResponse = zPortainerEdgeStack;

export const zEdgeStackCreateFileBody = z.object({
  Name: z.string(),
  file: z.union([z.instanceof(Blob), z.instanceof(File)]),
  EdgeGroups: z.string(),
  DeploymentType: z.int(),
  Registries: z.string().optional(),
  UseManifestNamespaces: z.boolean().optional(),
  PrePullImage: z.boolean().optional(),
  RetryDeploy: z.boolean().optional(),
});

export const zEdgeStackCreateFileQuery = z.object({
  dryrun: z.string().optional(),
});

/**
 * OK
 */
export const zEdgeStackCreateFileResponse = zPortainerEdgeStack;

/**
 * stack config
 */
export const zEdgeStackCreateRepositoryBody =
  zEdgestacksEdgeStackFromGitRepositoryPayload;

export const zEdgeStackCreateRepositoryQuery = z.object({
  dryrun: z.string().optional(),
});

/**
 * OK
 */
export const zEdgeStackCreateRepositoryResponse = zPortainerEdgeStack;

/**
 * stack config
 */
export const zEdgeStackCreateStringBody = zEdgestacksEdgeStackFromStringPayload;

export const zEdgeStackCreateStringQuery = z.object({
  dryrun: z.string().optional(),
});

/**
 * OK
 */
export const zEdgeStackCreateStringResponse = zPortainerEdgeStack;

export const zEndpointGroupListQuery = z.object({
  size: z.boolean().optional(),
});

/**
 * Environment(Endpoint) group
 */
export const zEndpointGroupListResponse = z.array(
  zEndpointgroupsEndpointGroupResponse
);

/**
 * Environment(Endpoint) Group details
 */
export const zPostEndpointGroupsBody =
  zEndpointgroupsEndpointGroupCreatePayload;

/**
 * Success
 */
export const zPostEndpointGroupsResponse = zPortainerEndpointGroup;

export const zEndpointGroupDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zEndpointGroupDeleteResponse = z.void();

export const zGetEndpointGroupsByIdPath = z.object({
  id: z.int(),
});

export const zGetEndpointGroupsByIdQuery = z.object({
  size: z.boolean().optional(),
});

/**
 * Success
 */
export const zGetEndpointGroupsByIdResponse =
  zEndpointgroupsEndpointGroupResponse;

/**
 * EndpointGroup details
 */
export const zEndpointGroupUpdateBody =
  zEndpointgroupsEndpointGroupUpdatePayload;

export const zEndpointGroupUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zEndpointGroupUpdateResponse = zPortainerEndpointGroup;

export const zEndpointGroupDeleteEndpointPath = z.object({
  id: z.int(),
  endpointId: z.int(),
});

/**
 * Success
 */
export const zEndpointGroupDeleteEndpointResponse = z.void();

export const zEndpointGroupAddEndpointPath = z.object({
  id: z.int(),
  endpointId: z.int(),
});

/**
 * Success
 */
export const zEndpointGroupAddEndpointResponse = z.void();

export const zEndpointListQuery = z.object({
  start: z.int().optional(),
  limit: z.int().optional(),
  sort: z
    .enum([
      'Name',
      'Group',
      'Status',
      'LastCheckIn',
      'EdgeID',
      'PlatformType',
      'Health',
      'Id',
    ])
    .optional(),
  order: z.string().optional(),
  search: z.string().optional(),
  groupIds: z.array(z.int()).optional(),
  status: z.array(z.int()).optional(),
  types: z
    .array(
      z.union([
        z.literal(0),
        z.literal(1),
        z.literal(2),
        z.literal(3),
        z.literal(4),
        z.literal(5),
        z.literal(6),
        z.literal(7),
      ])
    )
    .optional(),
  platformTypes: z
    .array(
      z.union([
        z.literal(0),
        z.literal(1),
        z.literal(2),
        z.literal(3),
        z.literal(4),
      ])
    )
    .optional(),
  outdated: z.boolean().optional(),
  excludeGroupIds: z.array(z.int()).optional(),
  tagIds: z.array(z.int()).optional(),
  tagsPartialMatch: z.boolean().optional(),
  endpointIds: z.array(z.int()).optional(),
  excludeIds: z.array(z.int()).optional(),
  agentVersions: z.array(z.string()).optional(),
  edgeAsync: z.boolean().optional(),
  edgeDeviceUntrusted: z.boolean().optional(),
  edgeCheckInPassedSeconds: z.number().optional(),
  excludeSnapshots: z.boolean().optional(),
  name: z.string().optional(),
  edgeStackId: z.int().optional(),
  edgeStackStatus: z
    .union([
      z.literal(0),
      z.literal(1),
      z.literal(2),
      z.literal(3),
      z.literal(4),
      z.literal(5),
      z.literal(6),
      z.literal(7),
      z.literal(8),
      z.literal(9),
      z.literal(10),
      z.literal(11),
      z.literal(12),
      z.literal(13),
    ])
    .optional(),
  edgeGroupIds: z.array(z.int()).optional(),
  excludeEdgeGroupIds: z.array(z.int()).optional(),
});

/**
 * Endpoints
 */
export const zEndpointListResponse = z.array(zPortainerEndpoint);

export const zEndpointCreateBody = z.object({
  Name: z.string(),
  EndpointCreationType: z.union([
    z.literal(0),
    z.literal(1),
    z.literal(2),
    z.literal(3),
    z.literal(4),
    z.literal(5),
  ]),
  ContainerEngine: z.string().optional(),
  URL: z.string().optional(),
  PublicURL: z.string().optional(),
  GroupID: z.int().optional(),
  TLS: z.boolean().optional(),
  TLSSkipVerify: z.boolean().optional(),
  TLSSkipClientVerify: z.boolean().optional(),
  TLSCACertFile: z.union([z.instanceof(Blob), z.instanceof(File)]).optional(),
  TLSCertFile: z.union([z.instanceof(Blob), z.instanceof(File)]).optional(),
  TLSKeyFile: z.union([z.instanceof(Blob), z.instanceof(File)]).optional(),
  AzureApplicationID: z.string().optional(),
  AzureTenantID: z.string().optional(),
  AzureAuthenticationKey: z.string().optional(),
  TagIds: z.string().optional(),
  EdgeCheckinInterval: z.int().optional(),
  EdgeTunnelServerAddress: z.string().optional(),
  Gpus: z.string().optional(),
});

/**
 * Success
 */
export const zEndpointCreateResponse = zPortainerEndpoint;

export const zEndpointDeletePath = z.object({
  id: z.int(),
});

/**
 * Environment successfully deleted.
 */
export const zEndpointDeleteResponse = z.void();

export const zEndpointInspectPath = z.object({
  id: z.int(),
});

export const zEndpointInspectQuery = z.object({
  excludeSnapshot: z.boolean().optional(),
});

/**
 * Success
 */
export const zEndpointInspectResponse = zPortainerEndpoint;

/**
 * Environment(Endpoint) details
 */
export const zEndpointUpdateBody = zEndpointsEndpointUpdatePayload;

export const zEndpointUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zEndpointUpdateResponse = zPortainerEndpoint;

export const zEndpointAssociationDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zEndpointAssociationDeleteResponse = z.void();

export const zPostEndpointsByIdDockerV2BrowsePutBody = z.object({
  Path: z.string(),
  file: z.union([z.instanceof(Blob), z.instanceof(File)]),
});

export const zPostEndpointsByIdDockerV2BrowsePutPath = z.object({
  id: z.int(),
});

export const zPostEndpointsByIdDockerV2BrowsePutQuery = z.object({
  volumeID: z.string().optional(),
});

/**
 * Success
 */
export const zPostEndpointsByIdDockerV2BrowsePutResponse = z.void();

export const zEndpointDockerhubStatusPath = z.object({
  id: z.int(),
  registryId: z.int(),
});

/**
 * Success
 */
export const zEndpointDockerhubStatusResponse =
  zEndpointsDockerhubStatusResponse;

/**
 * details
 */
export const zEndpointForceUpdateServiceBody =
  zEndpointsForceUpdateServicePayload;

export const zEndpointForceUpdateServicePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zEndpointForceUpdateServiceResponse = zSwarmServiceUpdateResponse;

export const zHelmListPath = z.object({
  id: z.int(),
});

export const zHelmListQuery = z.object({
  namespace: z.string().optional(),
  filter: z.string().optional(),
  selector: z.string().optional(),
});

/**
 * Success
 */
export const zHelmListResponse = z.array(zReleaseReleaseElement);

/**
 * Chart details
 */
export const zHelmInstallBody = zHelmInstallChartPayload;

export const zHelmInstallPath = z.object({
  id: z.int(),
});

export const zHelmInstallQuery = z.object({
  dryRun: z.boolean().optional(),
});

/**
 * Created
 */
export const zHelmInstallResponse = zReleaseRelease;

export const zHelmDeletePath = z.object({
  id: z.int(),
  release: z.string(),
});

export const zHelmDeleteQuery = z.object({
  namespace: z.string().optional(),
});

/**
 * Success
 */
export const zHelmDeleteResponse = z.void();

export const zHelmGetPath = z.object({
  id: z.int(),
  release: z.string(),
});

export const zHelmGetQuery = z.object({
  namespace: z.string().optional(),
  showResources: z.boolean().optional(),
  revision: z.int().optional(),
});

/**
 * Success
 */
export const zHelmGetResponse = zReleaseRelease;

export const zHelmGetHistoryPath = z.object({
  id: z.int(),
  release: z.string(),
});

export const zHelmGetHistoryQuery = z.object({
  namespace: z.string().optional(),
});

/**
 * Success
 */
export const zHelmGetHistoryResponse = z.array(zReleaseRelease);

export const zHelmRollbackPath = z.object({
  id: z.int(),
  release: z.string(),
});

export const zHelmRollbackQuery = z.object({
  namespace: z.string().optional(),
  revision: z.int().optional(),
  wait: z.boolean().optional(),
  waitForJobs: z.boolean().optional(),
  recreate: z.boolean().optional(),
  force: z.boolean().optional(),
  timeout: z.int().optional(),
});

/**
 * Success
 */
export const zHelmRollbackResponse = zReleaseRelease;

export const zEndpointRegistriesListPath = z.object({
  id: z.int(),
});

export const zEndpointRegistriesListQuery = z.object({
  namespace: z.string().optional(),
});

/**
 * Success
 */
export const zEndpointRegistriesListResponse = z.array(zPortainerRegistry);

/**
 * details
 */
export const zEndpointRegistryAccessBody = zEndpointsRegistryAccessPayload;

export const zEndpointRegistryAccessPath = z.object({
  id: z.int(),
  registryId: z.int(),
});

/**
 * Success
 */
export const zEndpointRegistryAccessResponse = z.void();

/**
 * Environment(Endpoint) details
 */
export const zEndpointSettingsUpdateBody =
  zEndpointsEndpointSettingsUpdatePayload;

export const zEndpointSettingsUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zEndpointSettingsUpdateResponse = zPortainerEndpoint;

export const zEndpointSnapshotPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zEndpointSnapshotResponse = z.void();

/**
 * List of environments to delete, with optional deleteCluster flag to clean-up associated resources (cloud environments only)
 */
export const zEndpointDeleteBatchBody = zEndpointsEndpointDeleteBatchPayload2;

export const zEndpointDeleteBatchResponse = z.union([
  z.void(),
  zEndpointsEndpointDeleteBatchPartialResponse,
]);

/**
 * Success
 */
export const zEndpointCreateGlobalKeyResponse =
  zEndpointsEndpointCreateGlobalKeyResponse;

/**
 * Environment relations data
 */
export const zEndpointUpdateRelationsBody =
  zEndpointsEndpointUpdateRelationsPayload;

/**
 * Success
 */
export const zEndpointUpdateRelationsResponse = z.void();

/**
 * Success
 */
export const zEndpointSnapshotsResponse = z.void();

/**
 * Environment summary counts
 */
export const zEndpointSummaryCountsResponse =
  zEndpointsEnvironmentSummaryCountsResponse;

/**
 * Template details
 */
export const zGitOperationRepoFilePreviewBody =
  zGitopsRepositoryFilePreviewPayload;

/**
 * Success
 */
export const zGitOperationRepoFilePreviewResponse = zGitopsFileResponse;

export const zGitOpsSourcesListQuery = z.object({
  search: z.string().optional(),
  sort: z.string().optional(),
  order: z.string().optional(),
  start: z.int().optional(),
  limit: z.int().optional(),
  status: z.string().optional(),
  type: z.enum(['git', 'helm', 'oci']).optional(),
});

/**
 * OK
 */
export const zGitOpsSourcesListResponse = z.array(zSourcesSource);

export const zGitOpsSourcesDeletePath = z.object({
  id: z.int(),
});

/**
 * Source deleted
 */
export const zGitOpsSourcesDeleteResponse = z.void();

export const zGitOpsSourceGetPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zGitOpsSourceGetResponse = zSourcesSourceDetail;

/**
 * Git source details
 */
export const zGitOpsSourcesUpdateGitBody = zSourcesGitSourceUpdatePayload;

export const zGitOpsSourcesUpdateGitPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zGitOpsSourcesUpdateGitResponse = zPortainerSource;

/**
 * Source access control
 */
export const zGitOpsSourcesUpdateAccessBody = zSourcesSourceAccessUpdatePayload;

export const zGitOpsSourcesUpdateAccessPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zGitOpsSourcesUpdateAccessResponse = zPortainerSource;

/**
 * Optional connection overrides; omitted fields fall back to stored values
 */
export const zGitOpsSourcesTestByIdBody = zSourcesGitSourceUpdatePayload;

export const zGitOpsSourcesTestByIdPath = z.object({
  id: z.int(),
});

/**
 * Connection test result
 */
export const zGitOpsSourcesTestByIdResponse = zSourcesConnectionTestResult;

/**
 * Git source details
 */
export const zGitOpsSourcesCreateGitBody = zSourcesGitSourceCreatePayload;

/**
 * Created
 */
export const zGitOpsSourcesCreateGitResponse = zPortainerSource;

/**
 * OK
 */
export const zGitOpsSourcesSummaryResponse = zWorkflowsStatusSummary;

/**
 * Git connection details
 */
export const zGitOpsSourcesTestBody = zSourcesGitSourceCreatePayload;

/**
 * Connection test result
 */
export const zGitOpsSourcesTestResponse = zSourcesConnectionTestResult;

export const zGitOpsWorkflowsListQuery = z.object({
  search: z.string().optional(),
  sort: z.enum(['name', 'status', 'creationDate', 'lastSyncDate']).optional(),
  order: z.enum(['asc', 'desc']).optional(),
  start: z.int().optional(),
  limit: z.int().optional(),
  endpointIds: z.array(z.int()).optional(),
  status: z
    .enum(['healthy', 'syncing', 'error', 'paused', 'unknown'])
    .optional(),
  type: z.enum(['stack']).optional(),
  platform: z
    .enum(['dockerStandalone', 'dockerSwarm', 'kubernetes'])
    .optional(),
});

/**
 * OK
 */
export const zGitOpsWorkflowsListResponse = z.array(zWorkflowsWorkflow);

export const zGitOpsWorkflowGetPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zGitOpsWorkflowGetResponse = zWorkflowsWorkflow;

/**
 * OK
 */
export const zGitOpsWorkflowsSummaryResponse = zWorkflowsStatusSummary;

export const zGetAllKubernetesApplicationsPath = z.object({
  id: z.int(),
});

export const zGetAllKubernetesApplicationsQuery = z.object({
  namespace: z.string(),
  nodeName: z.string(),
});

/**
 * Success
 */
export const zGetAllKubernetesApplicationsResponse = z.array(
  zKubernetesK8sApplication
);

export const zGetAllKubernetesApplicationsCountPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesApplicationsCountResponse = z.int();

/**
 * A list of cluster role bindings to delete
 */
export const zDeleteClusterRoleBindingsBody = z.array(z.string());

export const zDeleteClusterRoleBindingsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteClusterRoleBindingsResponse = z.void();

/**
 * A list of cluster roles to delete
 */
export const zDeleteClusterRolesBody = z.array(z.string());

export const zDeleteClusterRolesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteClusterRolesResponse = z.void();

export const zGetAllKubernetesClusterRoleBindingsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesClusterRoleBindingsResponse = z.array(
  zKubernetesK8sClusterRoleBinding
);

export const zGetAllKubernetesClusterRolesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesClusterRolesResponse = z.array(
  zKubernetesK8sClusterRole
);

export const zGetAllKubernetesConfigMapsPath = z.object({
  id: z.int(),
});

export const zGetAllKubernetesConfigMapsQuery = z.object({
  isUsed: z.boolean(),
});

/**
 * Success
 */
export const zGetAllKubernetesConfigMapsResponse = z.array(
  zKubernetesK8sConfigMap
);

export const zGetAllKubernetesConfigMapsCountPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesConfigMapsCountResponse = z.int();

export const zGetKubernetesCronJobsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesCronJobsResponse = z.array(zKubernetesK8sCronJob);

/**
 * A map where the key is the namespace and the value is an array of Cron Jobs to delete
 */
export const zDeleteCronJobsBody = zKubernetesK8sCronJobDeleteRequests;

export const zDeleteCronJobsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteCronJobsResponse = z.void();

export const zGetKubernetesDashboardPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesDashboardResponse = z.array(zKubernetesK8sDashboard);

export const zDescribeResourcePath = z.object({
  id: z.int(),
});

export const zDescribeResourceQuery = z.object({
  name: z.string(),
  kind: z.string(),
  namespace: z.string().optional(),
});

/**
 * Success
 */
export const zDescribeResourceResponse = zKubernetesDescribeResourceResponse;

export const zGetAllKubernetesEventsPath = z.object({
  id: z.int(),
});

export const zGetAllKubernetesEventsQuery = z.object({
  resourceId: z.string().optional(),
});

/**
 * Success
 */
export const zGetAllKubernetesEventsResponse = z.array(zKubernetesK8sEvent);

export const zGetAllKubernetesIngressControllersPath = z.object({
  id: z.int(),
});

export const zGetAllKubernetesIngressControllersQuery = z.object({
  allowedOnly: z.boolean().optional(),
});

/**
 * Success
 */
export const zGetAllKubernetesIngressControllersResponse = z.array(
  zKubernetesK8sIngressController
);

/**
 * Ingress controllers
 */
export const zUpdateKubernetesIngressControllersBody =
  zKubernetesK8sIngressControllerArray;

export const zUpdateKubernetesIngressControllersPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUpdateKubernetesIngressControllersResponse = z.void();

export const zGetAllKubernetesClusterIngressesPath = z.object({
  id: z.int(),
});

export const zGetAllKubernetesClusterIngressesQuery = z.object({
  withServices: z.boolean().optional(),
});

/**
 * Success
 */
export const zGetAllKubernetesClusterIngressesResponse = z.array(
  zKubernetesK8sIngressInfo
);

export const zGetAllKubernetesClusterIngressesCountPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesClusterIngressesCountResponse = z.int();

/**
 * Ingress details
 */
export const zDeleteKubernetesIngressesBody =
  zKubernetesK8sIngressDeleteRequests;

export const zDeleteKubernetesIngressesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteKubernetesIngressesResponse = z.void();

export const zGetKubernetesJobsPath = z.object({
  id: z.int(),
});

export const zGetKubernetesJobsQuery = z.object({
  includeCronJobChildren: z.boolean().optional(),
});

/**
 * Success
 */
export const zGetKubernetesJobsResponse = z.array(zKubernetesK8sJob);

/**
 * A map where the key is the namespace and the value is an array of Jobs to delete
 */
export const zDeleteJobsBody = zKubernetesK8sJobDeleteRequests;

export const zDeleteJobsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteJobsResponse = z.void();

export const zGetKubernetesMaxResourceLimitsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesMaxResourceLimitsResponse = zPortainerK8sNodesLimits;

export const zGetApplicationsResourcesPath = z.object({
  id: z.int(),
});

export const zGetApplicationsResourcesQuery = z.object({
  node: z.string(),
});

/**
 * Success
 */
export const zGetApplicationsResourcesResponse =
  zKubernetesK8sApplicationResource;

export const zGetKubernetesMetricsForAllNodesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesMetricsForAllNodesResponse = zV1Beta1NodeMetricsList;

export const zGetKubernetesMetricsForNodePath = z.object({
  id: z.int(),
  name: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesMetricsForNodeResponse = zV1Beta1NodeMetrics;

export const zGetKubernetesMetricsForAllPodsPath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesMetricsForAllPodsResponse = zV1Beta1PodMetricsList;

export const zGetKubernetesMetricsForPodPath = z.object({
  id: z.int(),
  namespace: z.string(),
  name: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesMetricsForPodResponse = zV1Beta1PodMetrics;

export const zDeleteKubernetesNamespacePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteKubernetesNamespaceResponse = z.string();

export const zGetKubernetesNamespacesPath = z.object({
  id: z.int(),
});

export const zGetKubernetesNamespacesQuery = z.object({
  withResourceQuota: z.boolean(),
  withUnhealthyEvents: z.boolean(),
});

/**
 * Success
 */
export const zGetKubernetesNamespacesResponse = z.array(
  zPortainerK8sNamespaceInfo
);

/**
 * Namespace configuration details
 */
export const zCreateKubernetesNamespaceBody = zKubernetesK8sNamespaceDetails;

export const zCreateKubernetesNamespacePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zCreateKubernetesNamespaceResponse = zPortainerK8sNamespaceInfo;

/**
 * Namespace details
 */
export const zUpdateKubernetesNamespaceDeprecatedBody =
  zKubernetesK8sNamespaceDetails2;

export const zUpdateKubernetesNamespaceDeprecatedPath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zUpdateKubernetesNamespaceDeprecatedResponse =
  zPortainerK8sNamespaceInfo;

export const zGetKubernetesNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

export const zGetKubernetesNamespaceQuery = z.object({
  withResourceQuota: z.boolean(),
});

/**
 * Success
 */
export const zGetKubernetesNamespaceResponse = zPortainerK8sNamespaceInfo;

/**
 * Namespace details
 */
export const zUpdateKubernetesNamespaceBody = zKubernetesK8sNamespaceDetails2;

export const zUpdateKubernetesNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zUpdateKubernetesNamespaceResponse = zPortainerK8sNamespaceInfo;

export const zGetKubernetesConfigMapPath = z.object({
  id: z.int(),
  namespace: z.string(),
  configmap: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesConfigMapResponse = zKubernetesK8sConfigMap;

export const zGetKubernetesEventsForNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

export const zGetKubernetesEventsForNamespaceQuery = z.object({
  resourceId: z.string().optional(),
});

/**
 * Success
 */
export const zGetKubernetesEventsForNamespaceResponse =
  z.array(zKubernetesK8sEvent);

export const zGetKubernetesIngressControllersByNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesIngressControllersByNamespaceResponse = z.array(
  zKubernetesK8sIngressController
);

/**
 * Ingress controllers
 */
export const zUpdateKubernetesIngressControllersByNamespaceBody =
  zKubernetesK8sIngressControllerArray;

export const zUpdateKubernetesIngressControllersByNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zUpdateKubernetesIngressControllersByNamespaceResponse = z.void();

export const zGetAllKubernetesIngressesPath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zGetAllKubernetesIngressesResponse = z.array(
  zKubernetesK8sIngressInfo
);

/**
 * Ingress details
 */
export const zCreateKubernetesIngressBody = zKubernetesK8sIngressInfo2;

export const zCreateKubernetesIngressPath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zCreateKubernetesIngressResponse = z.void();

/**
 * Ingress details
 */
export const zUpdateKubernetesIngressBody = zKubernetesK8sIngressInfo2;

export const zUpdateKubernetesIngressPath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zUpdateKubernetesIngressResponse = z.void();

export const zGetKubernetesIngressPath = z.object({
  id: z.int(),
  namespace: z.string(),
  ingress: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesIngressResponse = zKubernetesK8sIngressInfo;

export const zGetKubernetesPersistentVolumeClaimsInNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesPersistentVolumeClaimsInNamespaceResponse = z.array(
  zKubernetesK8sPersistentVolumeClaim
);

export const zGetKubernetesPersistentVolumeClaimPath = z.object({
  id: z.int(),
  namespace: z.string(),
  name: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesPersistentVolumeClaimResponse =
  zKubernetesK8sPersistentVolumeClaim;

export const zDeleteKubernetesPodPath = z.object({
  id: z.int(),
  namespace: z.string(),
  name: z.string(),
});

/**
 * Success
 */
export const zDeleteKubernetesPodResponse = z.void();

export const zRestartKubernetesPodPath = z.object({
  id: z.int(),
  namespace: z.string(),
  name: z.string(),
});

/**
 * Success
 */
export const zRestartKubernetesPodResponse = z.void();

export const zGetKubernetesSecretPath = z.object({
  id: z.int(),
  namespace: z.string(),
  secret: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesSecretResponse = zKubernetesK8sSecret;

export const zGetKubernetesServiceAccountPath = z.object({
  id: z.int(),
  namespace: z.string(),
  name: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesServiceAccountResponse =
  zKubernetesK8sServiceAccount;

/**
 * New imagePullSecrets list
 */
export const zUpdateKubernetesServiceAccountImagePullSecretsBody =
  zKubernetesK8sServiceAccountImagePullSecretsUpdatePayload;

export const zUpdateKubernetesServiceAccountImagePullSecretsPath = z.object({
  id: z.int(),
  namespace: z.string(),
  name: z.string(),
});

/**
 * Success
 */
export const zUpdateKubernetesServiceAccountImagePullSecretsResponse = z.void();

export const zGetKubernetesServicesByNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesServicesByNamespaceResponse = z.array(
  zKubernetesK8sServiceInfo
);

/**
 * Service definition
 */
export const zCreateKubernetesServiceBody = zKubernetesK8sServiceInfo2;

export const zCreateKubernetesServicePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zCreateKubernetesServiceResponse = z.void();

/**
 * Service definition
 */
export const zUpdateKubernetesServiceBody = zKubernetesK8sServiceInfo2;

export const zUpdateKubernetesServicePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zUpdateKubernetesServiceResponse = z.void();

/**
 * Update details
 */
export const zKubernetesNamespacesToggleSystemBody =
  zKubernetesNamespacesToggleSystemPayload;

export const zKubernetesNamespacesToggleSystemPath = z.object({
  id: z.int(),
  namespace: z.string(),
});

/**
 * Success
 */
export const zKubernetesNamespacesToggleSystemResponse = z.void();

export const zGetKubernetesVolumesInNamespacePath = z.object({
  id: z.int(),
  namespace: z.string(),
});

export const zGetKubernetesVolumesInNamespaceQuery = z.object({
  withApplications: z.boolean().optional(),
});

/**
 * Success
 */
export const zGetKubernetesVolumesInNamespaceResponse = z.record(
  z.string(),
  zKubernetesK8sVolumeInfo
);

export const zGetKubernetesNamespacesCountPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesNamespacesCountResponse = z.int();

export const zGetKubernetesNodesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesNodesResponse = z.array(
  zKubernetesKubernetesNodeResponse
);

export const zDrainNodePath = z.object({
  id: z.int(),
  name: z.string(),
});

/**
 * Success
 */
export const zDrainNodeResponse = z.void();

export const zGetKubernetesNodesLimitsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesNodesLimitsResponse = zPortainerK8sNodesLimits;

export const zGetAllKubernetesPersistentVolumeClaimsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesPersistentVolumeClaimsResponse = z.array(
  zKubernetesK8sPersistentVolumeClaim
);

/**
 * List of PVCs to delete (namespace + name)
 */
export const zDeleteKubernetesPersistentVolumeClaimsBody = z.array(
  zKubernetesK8sVolumeDeleteRequest
);

export const zDeleteKubernetesPersistentVolumeClaimsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteKubernetesPersistentVolumeClaimsResponse = z.void();

/**
 * PVC resize request
 */
export const zResizeKubernetesPersistentVolumeClaimBody =
  zKubernetesK8sPvcResizeRequest;

export const zResizeKubernetesPersistentVolumeClaimPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zResizeKubernetesPersistentVolumeClaimResponse = z.void();

export const zGetAllKubernetesPersistentVolumesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesPersistentVolumesResponse = z.array(
  zKubernetesK8sPersistentVolume
);

export const zGetKubernetesPersistentVolumePath = z.object({
  id: z.int(),
  name: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesPersistentVolumeResponse =
  zKubernetesK8sPersistentVolume;

/**
 * List of PV names to delete
 */
export const zDeleteKubernetesPersistentVolumesBody = z.array(z.string());

export const zDeleteKubernetesPersistentVolumesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteKubernetesPersistentVolumesResponse = z.void();

/**
 * Reclaim policy update request
 */
export const zUpdateKubernetesPersistentVolumeReclaimPolicyBody =
  zKubernetesK8sPvReclaimPolicyRequest;

export const zUpdateKubernetesPersistentVolumeReclaimPolicyPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUpdateKubernetesPersistentVolumeReclaimPolicyResponse = z.void();

export const zGetKubernetesRbacStatusPath = z.object({
  id: z.int(),
});

/**
 * RBAC status
 */
export const zGetKubernetesRbacStatusResponse = z.boolean();

/**
 * A map where the key is the namespace and the value is an array of role bindings to delete
 */
export const zDeleteRoleBindingsBody = zKubernetesK8sRoleBindingDeleteRequests;

export const zDeleteRoleBindingsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteRoleBindingsResponse = z.void();

export const zGetKubernetesRoleBindingsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesRoleBindingsResponse = z.array(
  zKubernetesK8sRoleBinding
);

export const zGetKubernetesRolesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesRolesResponse = z.array(zKubernetesK8sRole);

/**
 * A map where the key is the namespace and the value is an array of roles to delete
 */
export const zDeleteRolesBody = zKubernetesK8sRoleDeleteRequests;

export const zDeleteRolesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteRolesResponse = z.void();

export const zGetKubernetesSecretsPath = z.object({
  id: z.int(),
});

export const zGetKubernetesSecretsQuery = z.object({
  isUsed: z.boolean(),
});

/**
 * Success
 */
export const zGetKubernetesSecretsResponse = z.array(zKubernetesK8sSecret);

export const zGetKubernetesSecretsCountPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesSecretsCountResponse = z.int();

/**
 * A map where the key is the namespace and the value is an array of service accounts to delete
 */
export const zDeleteServiceAccountsBody =
  zKubernetesK8sServiceAccountDeleteRequests;

export const zDeleteServiceAccountsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteServiceAccountsResponse = z.void();

export const zGetKubernetesServiceAccountsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesServiceAccountsResponse = z.array(
  zKubernetesK8sServiceAccount
);

export const zGetKubernetesServicesPath = z.object({
  id: z.int(),
});

export const zGetKubernetesServicesQuery = z.object({
  withApplications: z.boolean().optional(),
});

/**
 * Success
 */
export const zGetKubernetesServicesResponse = z.array(
  zKubernetesK8sServiceInfo
);

export const zGetAllKubernetesServicesCountPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesServicesCountResponse = z.int();

/**
 * A map where the key is the namespace and the value is an array of services to delete
 */
export const zDeleteKubernetesServicesBody =
  zKubernetesK8sServiceDeleteRequests;

export const zDeleteKubernetesServicesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteKubernetesServicesResponse = z.void();

export const zGetAllKubernetesStorageClassesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesStorageClassesResponse = z.array(
  zKubernetesK8sStorageClass
);

export const zGetKubernetesStorageClassPath = z.object({
  id: z.int(),
  name: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesStorageClassResponse = zKubernetesK8sStorageClass;

export const zSetDefaultKubernetesStorageClassPath = z.object({
  id: z.int(),
  name: z.string(),
});

/**
 * Success
 */
export const zSetDefaultKubernetesStorageClassResponse = z.void();

/**
 * List of StorageClass names to delete
 */
export const zDeleteKubernetesStorageClassesBody = z.array(z.string());

export const zDeleteKubernetesStorageClassesPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zDeleteKubernetesStorageClassesResponse = z.void();

export const zGetKubernetesVersionPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetKubernetesVersionResponse =
  zKubernetesKubernetesVersionResponse;

export const zGetAllKubernetesVolumesPath = z.object({
  id: z.int(),
});

export const zGetAllKubernetesVolumesQuery = z.object({
  withApplications: z.boolean().optional(),
});

/**
 * Success
 */
export const zGetAllKubernetesVolumesResponse = z.record(
  z.string(),
  zKubernetesK8sVolumeInfo
);

export const zGetKubernetesVolumePath = z.object({
  id: z.int(),
  namespace: z.string(),
  volume: z.string(),
});

/**
 * Success
 */
export const zGetKubernetesVolumeResponse = zKubernetesK8sVolumeInfo;

export const zGetAllKubernetesVolumesCountPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zGetAllKubernetesVolumesCountResponse = z.int();

export const zGetKubernetesConfigQuery = z.object({
  ids: z.array(z.int()).optional(),
  excludeIds: z.array(z.int()).optional(),
});

/**
 * details
 */
export const zLdapCheckBody = zLdapCheckPayload;

/**
 * Success
 */
export const zLdapCheckResponse = z.void();

/**
 * OK
 */
export const zMotdResponse = zMotdMotd;

/**
 * Success
 */
export const zRegistryListResponse = z.array(zPortainerRegistry);

/**
 * Registry details
 */
export const zRegistryCreateBody = zRegistriesRegistryCreatePayload;

/**
 * Success
 */
export const zRegistryCreateResponse = zPortainerRegistry;

export const zRegistryDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zRegistryDeleteResponse = z.void();

export const zRegistryInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zRegistryInspectResponse = zPortainerRegistry;

/**
 * Registry details
 */
export const zRegistryUpdateBody = zRegistriesRegistryUpdatePayload;

export const zRegistryUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zRegistryUpdateResponse = zPortainerRegistry;

/**
 * Registry configuration
 */
export const zRegistryConfigureBody = zRegistriesRegistryConfigurePayload;

export const zRegistryConfigurePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zRegistryConfigureResponse = z.void();

/**
 * Registry credentials to test
 */
export const zRegistryPingBody = zRegistriesRegistryPingPayload;

/**
 * Success
 */
export const zRegistryPingResponse = zRegistriesRegistryPingResponse;

/**
 * Resource control details
 */
export const zResourceControlCreateBody =
  zResourcecontrolsResourceControlCreatePayload;

/**
 * Success
 */
export const zResourceControlCreateResponse = zPortainerResourceControl;

export const zResourceControlDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zResourceControlDeleteResponse = z.void();

/**
 * Resource control details
 */
export const zResourceControlUpdateBody =
  zResourcecontrolsResourceControlUpdatePayload;

export const zResourceControlUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zResourceControlUpdateResponse = zPortainerResourceControl;

/**
 * Restore request payload
 */
export const zRestoreBody = zBackupRestorePayload;

export const zRestoreHeaders = z.object({
  'X-Setup-Token': z.string().optional(),
});

/**
 * Success
 */
export const zRoleListResponse = z.array(zPortainerRole);

/**
 * Success
 */
export const zSettingsInspectResponse = zPortainerSettings;

/**
 * New settings
 */
export const zSettingsUpdateBody = zSettingsSettingsUpdatePayload;

/**
 * Success
 */
export const zSettingsUpdateResponse = zPortainerSettings;

/**
 * Success
 */
export const zSettingsPublicResponse = zSettingsPublicSettingsResponse;

/**
 * Success
 */
export const zSslInspectResponse = zPortainerSslSettings;

/**
 * SSL Settings
 */
export const zSslUpdateBody = zSslSslUpdatePayload;

/**
 * Success
 */
export const zSslUpdateResponse = z.void();

export const zStackListQuery = z.object({
  filters: z.string().optional(),
});

export const zStackListResponse = z.union([z.array(zPortainerStack), z.void()]);

export const zStackDeletePath = z.object({
  id: z.int(),
});

export const zStackDeleteQuery = z.object({
  external: z.boolean().optional(),
  endpointId: z.int(),
});

/**
 * Success
 */
export const zStackDeleteResponse = z.void();

export const zStackInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zStackInspectResponse = zStacksStackResponse;

/**
 * Stack details
 */
export const zStackUpdateBody = zStacksUpdateSwarmStackPayload;

export const zStackUpdatePath = z.object({
  id: z.int(),
});

export const zStackUpdateQuery = z.object({
  endpointId: z.int(),
});

/**
 * Success
 */
export const zStackUpdateResponse = zPortainerStack;

export const zStackAssociatePath = z.object({
  id: z.int(),
});

export const zStackAssociateQuery = z.object({
  endpointId: z.int(),
  swarmId: z.int(),
  orphanedRunning: z.boolean(),
});

/**
 * Success
 */
export const zStackAssociateResponse = zPortainerStack;

export const zStackFileInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zStackFileInspectResponse = zStacksStackFileResponse;

/**
 * Git configs for pull and redeploy a stack
 */
export const zStackUpdateGitBody = zStacksStackGitUpdatePayload;

export const zStackUpdateGitPath = z.object({
  id: z.int(),
});

export const zStackUpdateGitQuery = z.object({
  endpointId: z.int().optional(),
});

/**
 * Success
 */
export const zStackUpdateGitResponse = zStacksStackResponse;

/**
 * Git configs for pull and redeploy of a stack. **StackName** may only be populated for Kuberenetes stacks, and if specified with a blank string, it will be set to blank
 */
export const zStackGitRedeployBody = zStacksStackGitRedeployPayload;

export const zStackGitRedeployPath = z.object({
  id: z.int(),
});

export const zStackGitRedeployQuery = z.object({
  endpointId: z.int().optional(),
});

/**
 * Success
 */
export const zStackGitRedeployResponse = zPortainerStack;

/**
 * Stack migration details
 */
export const zStackMigrateBody = zStacksStackMigratePayload;

export const zStackMigratePath = z.object({
  id: z.int(),
});

export const zStackMigrateQuery = z.object({
  endpointId: z.int().optional(),
});

/**
 * Success
 */
export const zStackMigrateResponse = zPortainerStack;

export const zStackStartPath = z.object({
  id: z.int(),
});

export const zStackStartQuery = z.object({
  endpointId: z.int(),
});

/**
 * Success
 */
export const zStackStartResponse = zPortainerStack;

export const zStackStopPath = z.object({
  id: z.int(),
});

export const zStackStopQuery = z.object({
  endpointId: z.int(),
});

/**
 * Success
 */
export const zStackStopResponse = zPortainerStack;

/**
 * stack config
 */
export const zStackCreateKubernetesGitBody =
  zStacksKubernetesGitDeploymentPayload;

export const zStackCreateKubernetesGitQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateKubernetesGitResponse = zPortainerStack;

/**
 * stack config
 */
export const zStackCreateKubernetesFileBody =
  zStacksKubernetesStringDeploymentPayload;

export const zStackCreateKubernetesFileQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateKubernetesFileResponse = zPortainerStack;

/**
 * stack config
 */
export const zStackCreateKubernetesUrlBody =
  zStacksKubernetesManifestUrlDeploymentPayload;

export const zStackCreateKubernetesUrlQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateKubernetesUrlResponse = zPortainerStack;

export const zStackCreateDockerStandaloneFileBody = z.object({
  Name: z.string(),
  Env: z.string().optional(),
  file: z.union([z.instanceof(Blob), z.instanceof(File)]).optional(),
});

export const zStackCreateDockerStandaloneFileQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateDockerStandaloneFileResponse = zPortainerStack;

/**
 * stack config
 */
export const zStackCreateDockerStandaloneRepositoryBody =
  zStacksComposeStackFromGitRepositoryPayload;

export const zStackCreateDockerStandaloneRepositoryQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateDockerStandaloneRepositoryResponse = zPortainerStack;

/**
 * stack config
 */
export const zStackCreateDockerStandaloneStringBody =
  zStacksComposeStackFromFileContentPayload;

export const zStackCreateDockerStandaloneStringQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateDockerStandaloneStringResponse = zPortainerStack;

export const zStackCreateDockerSwarmFileBody = z.object({
  Name: z.string().optional(),
  SwarmID: z.string().optional(),
  Env: z.string().optional(),
  file: z.union([z.instanceof(Blob), z.instanceof(File)]).optional(),
});

export const zStackCreateDockerSwarmFileQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateDockerSwarmFileResponse = zPortainerStack;

/**
 * stack config
 */
export const zStackCreateDockerSwarmRepositoryBody =
  zStacksSwarmStackFromGitRepositoryPayload;

export const zStackCreateDockerSwarmRepositoryQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateDockerSwarmRepositoryResponse = zPortainerStack;

/**
 * stack config
 */
export const zStackCreateDockerSwarmStringBody =
  zStacksSwarmStackFromFileContentPayload;

export const zStackCreateDockerSwarmStringQuery = z.object({
  endpointId: z.int(),
});

/**
 * OK
 */
export const zStackCreateDockerSwarmStringResponse = zPortainerStack;

export const zStackDeleteKubernetesByNamePath = z.object({
  name: z.string(),
});

export const zStackDeleteKubernetesByNameQuery = z.object({
  external: z.boolean().optional(),
  endpointId: z.int(),
});

/**
 * Success
 */
export const zStackDeleteKubernetesByNameResponse = z.void();

export const zWebhookInvokePath = z.object({
  webhookID: z.string(),
});

/**
 * Success
 */
export const zSystemInfoResponse = zSystemSystemInfoResponse;

/**
 * Success
 */
export const zSystemNodesCountResponse2 = zSystemNodesCountResponse;

/**
 * Success
 */
export const zSystemStatusResponse = zSystemStatus;

/**
 * Success
 */
export const zSystemUpgradeResponse = zSystemStatus;

/**
 * Success
 */
export const zSystemVersionResponse2 = zSystemVersionResponse;

/**
 * Success
 */
export const zTagListResponse = z.array(zPortainerTag);

/**
 * Tag details
 */
export const zTagCreateBody = zTagsTagCreatePayload;

/**
 * Success
 */
export const zTagCreateResponse = zPortainerTag;

export const zTagDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTagDeleteResponse = z.void();

/**
 * Success
 */
export const zTeamMembershipListResponse = z.array(zPortainerTeamMembership);

/**
 * Team membership details
 */
export const zTeamMembershipCreateBody =
  zTeammembershipsTeamMembershipCreatePayload;

/**
 * Success
 */
export const zTeamMembershipCreateResponse = zPortainerTeamMembership;

export const zTeamMembershipDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTeamMembershipDeleteResponse = z.void();

/**
 * Team membership details
 */
export const zTeamMembershipUpdateBody =
  zTeammembershipsTeamMembershipUpdatePayload;

export const zTeamMembershipUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTeamMembershipUpdateResponse = zPortainerTeamMembership;

export const zTeamListQuery = z.object({
  onlyLedTeams: z.boolean().optional(),
  environmentId: z.int().optional(),
});

/**
 * Success
 */
export const zTeamListResponse = z.array(zPortainerTeam);

/**
 * details
 */
export const zTeamCreateBody = zTeamsTeamCreatePayload;

/**
 * Success
 */
export const zTeamCreateResponse = zPortainerTeam;

export const zTeamDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTeamDeleteResponse = z.void();

export const zTeamInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTeamInspectResponse = zPortainerTeam;

/**
 * Team details
 */
export const zTeamUpdateBody = zTeamsTeamUpdatePayload;

export const zTeamUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTeamUpdateResponse = zPortainerTeam;

export const zTeamMembershipsPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTeamMembershipsResponse = z.array(zPortainerTeamMembership);

/**
 * Success
 */
export const zTemplateListResponse = zTemplatesListResponse;

export const zTemplateFilePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zTemplateFileResponse = zTemplatesFileResponse;

export const zHelmRepoSearchQuery = z.object({
  repo: z.string(),
  chart: z.string().optional(),
  useCache: z.string().optional(),
});

/**
 * Success
 */
export const zHelmRepoSearchResponse = z.string();

export const zHelmShowPath = z.object({
  command: z.string(),
});

export const zHelmShowQuery = z.object({
  repo: z.string(),
  chart: z.string(),
  version: z.string().optional(),
});

/**
 * Success
 */
export const zHelmShowResponse = z.string();

export const zUploadTlsBody = z.object({
  folder: z.string(),
  file: z.union([z.instanceof(Blob), z.instanceof(File)]),
});

export const zUploadTlsPath = z.object({
  certificate: z.enum(['ca', 'cert', 'key']),
});

/**
 * Success
 */
export const zUploadTlsResponse = z.void();

export const zUserListQuery = z.object({
  environmentId: z.int().optional(),
});

/**
 * Success
 */
export const zUserListResponse = z.array(zPortainerUser);

/**
 * User details
 */
export const zUserCreateBody = zUsersUserCreatePayload;

/**
 * Success
 */
export const zUserCreateResponse = zPortainerUser;

export const zUserDeletePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserDeleteResponse = z.void();

export const zUserInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserInspectResponse = zPortainerUser;

/**
 * User details
 */
export const zUserUpdateBody = zUsersUserUpdatePayload;

export const zUserUpdatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserUpdateResponse = zPortainerUser;

export const zUserEffectiveAccessInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserEffectiveAccessInspectResponse = z.array(
  zUsersEffectiveAccessEntry
);

export const zHelmUserRepositoriesListPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zHelmUserRepositoriesListResponse =
  zUsersHelmUserRepositoryResponse;

/**
 * Helm Repository
 */
export const zHelmUserRepositoryCreateBody = zUsersAddHelmRepoUrlPayload;

export const zHelmUserRepositoryCreatePath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zHelmUserRepositoryCreateResponse = zPortainerHelmUserRepository;

export const zHelmUserRepositoryDeletePath = z.object({
  id: z.int(),
  repositoryID: z.int(),
});

/**
 * Success
 */
export const zHelmUserRepositoryDeleteResponse = z.void();

export const zUserMembershipsInspectPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserMembershipsInspectResponse = zPortainerTeamMembership;

/**
 * details
 */
export const zUserUpdatePasswordBody = zUsersUserUpdatePasswordPayload;

export const zUserUpdatePasswordPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserUpdatePasswordResponse = z.void();

export const zUserGetApiKeysPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserGetApiKeysResponse = z.array(zPortainerApiKey);

/**
 * details
 */
export const zUserGenerateApiKeyBody = zUsersUserAccessTokenCreatePayload;

export const zUserGenerateApiKeyPath = z.object({
  id: z.int(),
});

/**
 * Success
 */
export const zUserGenerateApiKeyResponse = zUsersAccessTokenResponse;

export const zUserRemoveApiKeyPath = z.object({
  id: z.int(),
  keyID: z.int(),
});

/**
 * Success
 */
export const zUserRemoveApiKeyResponse = z.void();

/**
 * Success
 */
export const zUserAdminCheckResponse = z.void();

/**
 * User details
 */
export const zUserAdminInitBody = zUsersAdminInitPayload;

export const zUserAdminInitHeaders = z.object({
  'X-Setup-Token': z.string().optional(),
});

/**
 * Success
 */
export const zUserAdminInitResponse = zPortainerUser;

/**
 * Success
 */
export const zCurrentUserInspectResponse = zPortainerUser;

export const zGetWebhooksQuery = z.object({
  filters: z.string().optional(),
});

/**
 * OK
 */
export const zGetWebhooksResponse = z.array(zPortainerWebhook);

/**
 * Webhook data
 */
export const zPostWebhooksBody = zWebhooksWebhookCreatePayload;

/**
 * OK
 */
export const zPostWebhooksResponse = zPortainerWebhook;

export const zDeleteWebhooksByIdPath = z.object({
  id: z.int(),
});

export const zPostWebhooksByIdPath = z.object({
  id: z.string(),
});

/**
 * Webhook data
 */
export const zPutWebhooksByIdBody = zWebhooksWebhookUpdatePayload;

export const zPutWebhooksByIdPath = z.object({
  id: z.int(),
});

/**
 * OK
 */
export const zPutWebhooksByIdResponse = zPortainerWebhook;

export const zGetWebsocketAttachQuery = z.object({
  endpointId: z.int(),
  nodeName: z.string().optional(),
});

export const zGetWebsocketExecQuery = z.object({
  endpointId: z.int(),
  nodeName: z.string().optional(),
});

export const zGetWebsocketKubernetesShellQuery = z.object({
  endpointId: z.int(),
});

export const zGetWebsocketPodQuery = z.object({
  endpointId: z.int(),
  namespace: z.string(),
  podName: z.string(),
  containerName: z.string(),
  command: z.string(),
});
