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

export const $ActionChange = {
  properties: {
    action_name: {
      type: "string",
      title: "Action Name",
    },
    change_type: {
      type: "string",
      enum: ["added", "removed", "modified"],
      title: "Change Type",
    },
    interface_changes: {
      items: {
        $ref: "#/components/schemas/ActionInterfaceChange",
      },
      type: "array",
      title: "Interface Changes",
    },
    description_changed: {
      type: "boolean",
      title: "Description Changed",
      default: false,
    },
  },
  type: "object",
  required: ["action_name", "change_type"],
  title: "ActionChange",
  description: "Describes a change to an action between two versions.",
} as const

export const $ActionControlFlow = {
  properties: {
    run_if: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Run If",
    },
    for_each: {
      anyOf: [
        {
          anyOf: [
            {
              type: "string",
            },
            {
              items: {
                type: "string",
              },
              type: "array",
            },
          ],
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "For Each",
    },
    join_strategy: {
      $ref: "#/components/schemas/JoinStrategy",
      default: "all",
    },
    retry_policy: {
      $ref: "#/components/schemas/ActionRetryPolicy",
    },
    start_delay: {
      type: "number",
      title: "Start Delay",
      description:
        "Delay before starting the action in seconds. If `wait_until` is also provided, the `wait_until` timer will take precedence.",
      default: 0,
    },
    wait_until: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wait Until",
      description:
        "Wait until a specific date and time before starting. Overrides `start_delay` if both are provided.",
    },
    environment: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Environment",
      description: "Override environment for this action's execution",
    },
    mask_output: {
      type: "boolean",
      title: "Mask Output",
      description:
        "If true, redact this action's result in workflow execution API responses while preserving internal workflow data flow between actions.",
      default: false,
    },
  },
  type: "object",
  title: "ActionControlFlow",
} as const

export const $ActionCreate = {
  properties: {
    workflow_id: {
      anyOf: [
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
      ],
      title: "Workflow Id",
    },
    type: {
      type: "string",
      title: "Type",
    },
    title: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Title",
    },
    description: {
      type: "string",
      maxLength: 1000,
      title: "Description",
      default: "",
    },
    inputs: {
      type: "string",
      maxLength: 300000,
      title: "Inputs",
      default: "",
    },
    control_flow: {
      anyOf: [
        {
          $ref: "#/components/schemas/ActionControlFlow",
        },
        {
          type: "null",
        },
      ],
      mode: "json",
    },
    is_interactive: {
      type: "boolean",
      title: "Is Interactive",
      default: false,
    },
    interaction: {
      anyOf: [
        {
          oneOf: [
            {
              $ref: "#/components/schemas/ResponseInteraction",
            },
            {
              $ref: "#/components/schemas/ApprovalInteraction",
            },
          ],
          description: "An interaction configuration",
          discriminator: {
            propertyName: "type",
            mapping: {
              approval: "#/components/schemas/ApprovalInteraction",
              response: "#/components/schemas/ResponseInteraction",
            },
          },
        },
        {
          type: "null",
        },
      ],
      title: "Interaction",
    },
    position_x: {
      type: "number",
      title: "Position X",
      default: 0,
    },
    position_y: {
      type: "number",
      title: "Position Y",
      default: 0,
    },
    upstream_edges: {
      items: {
        $ref: "#/components/schemas/ActionEdge",
      },
      type: "array",
      title: "Upstream Edges",
    },
  },
  type: "object",
  required: ["workflow_id", "type", "title"],
  title: "ActionCreate",
} as const

export const $ActionEdge = {
  properties: {
    source_id: {
      type: "string",
      title: "Source Id",
    },
    source_type: {
      type: "string",
      enum: ["trigger", "udf"],
      title: "Source Type",
    },
    source_handle: {
      type: "string",
      enum: ["success", "error"],
      title: "Source Handle",
    },
  },
  type: "object",
  required: ["source_id", "source_type"],
  title: "ActionEdge",
  description: `Represents an incoming edge to an action.

Stored in Action.upstream_edges to represent incoming connections.`,
} as const

export const $ActionInterfaceChange = {
  properties: {
    field: {
      type: "string",
      enum: ["expects", "returns"],
      title: "Field",
    },
    change_type: {
      type: "string",
      enum: ["added", "removed", "modified"],
      title: "Change Type",
    },
    old_value: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Old Value",
    },
    new_value: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "New Value",
    },
  },
  type: "object",
  required: ["field", "change_type"],
  title: "ActionInterfaceChange",
  description:
    "Describes a change to an action's interface (expects or returns).",
} as const

export const $ActionPositionUpdate = {
  properties: {
    action_id: {
      type: "string",
      format: "uuid",
      title: "Action Id",
    },
    position: {
      $ref: "#/components/schemas/Position",
    },
  },
  type: "object",
  required: ["action_id", "position"],
  title: "ActionPositionUpdate",
  description: "Position update for a single action.",
} as const

export const $ActionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    type: {
      type: "string",
      title: "Type",
    },
    title: {
      type: "string",
      title: "Title",
    },
    description: {
      type: "string",
      title: "Description",
    },
    status: {
      type: "string",
      title: "Status",
    },
    inputs: {
      type: "string",
      title: "Inputs",
    },
    control_flow: {
      $ref: "#/components/schemas/ActionControlFlow",
    },
    is_interactive: {
      type: "boolean",
      title: "Is Interactive",
    },
    interaction: {
      anyOf: [
        {
          oneOf: [
            {
              $ref: "#/components/schemas/ResponseInteraction",
            },
            {
              $ref: "#/components/schemas/ApprovalInteraction",
            },
          ],
          description: "An interaction configuration",
          discriminator: {
            propertyName: "type",
            mapping: {
              approval: "#/components/schemas/ApprovalInteraction",
              response: "#/components/schemas/ResponseInteraction",
            },
          },
        },
        {
          type: "null",
        },
      ],
      title: "Interaction",
    },
    position_x: {
      type: "number",
      title: "Position X",
      default: 0,
    },
    position_y: {
      type: "number",
      title: "Position Y",
      default: 0,
    },
    upstream_edges: {
      items: {
        $ref: "#/components/schemas/ActionEdge",
      },
      type: "array",
      title: "Upstream Edges",
    },
    ref: {
      type: "string",
      title: "Ref",
      readOnly: true,
    },
  },
  type: "object",
  required: [
    "id",
    "type",
    "title",
    "description",
    "status",
    "inputs",
    "is_interactive",
    "ref",
  ],
  title: "ActionRead",
} as const

export const $ActionReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workflow_id: {
      type: "string",
      pattern: "wf_[0-9a-zA-Z]+",
      title: "Workflow Id",
    },
    type: {
      type: "string",
      title: "Type",
    },
    title: {
      type: "string",
      title: "Title",
    },
    description: {
      type: "string",
      title: "Description",
    },
    status: {
      type: "string",
      title: "Status",
    },
    is_interactive: {
      type: "boolean",
      title: "Is Interactive",
    },
  },
  type: "object",
  required: [
    "id",
    "workflow_id",
    "type",
    "title",
    "description",
    "status",
    "is_interactive",
  ],
  title: "ActionReadMinimal",
} as const

export const $ActionRetryPolicy = {
  properties: {
    max_attempts: {
      type: "integer",
      title: "Max Attempts",
      description:
        "Total number of execution attempts. 0 means unlimited, 1 means no retries.",
      default: 1,
    },
    timeout: {
      type: "integer",
      title: "Timeout",
      description: "Timeout for the action in seconds.",
      default: 300,
    },
    retry_until: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Retry Until",
      description: "Retry until a specific condition is met.",
    },
  },
  type: "object",
  title: "ActionRetryPolicy",
} as const

export const $ActionStatement = {
  properties: {
    ref: {
      type: "string",
      pattern: "^[a-z0-9_]+$",
      title: "Ref",
      description: "Unique reference for the task",
    },
    description: {
      type: "string",
      title: "Description",
      default: "",
    },
    action: {
      type: "string",
      pattern: "^[a-z0-9_.]+$",
      title: "Action",
      description: "Action type. Equivalent to the UDF key.",
    },
    args: {
      additionalProperties: true,
      type: "object",
      title: "Args",
      description: "Arguments for the action",
    },
    depends_on: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Depends On",
      description: "Task dependencies",
    },
    interaction: {
      anyOf: [
        {
          oneOf: [
            {
              $ref: "#/components/schemas/ResponseInteraction",
            },
            {
              $ref: "#/components/schemas/ApprovalInteraction",
            },
          ],
          description: "An interaction configuration",
          discriminator: {
            propertyName: "type",
            mapping: {
              approval: "#/components/schemas/ApprovalInteraction",
              response: "#/components/schemas/ResponseInteraction",
            },
          },
        },
        {
          type: "null",
        },
      ],
      title: "Interaction",
      description: "Whether the action is interactive.",
    },
    run_if: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Run If",
      description: "Condition to run the task",
    },
    for_each: {
      anyOf: [
        {
          type: "string",
        },
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "For Each",
      description:
        "Iterate over a list of items and run the task for each item.",
    },
    retry_policy: {
      $ref: "#/components/schemas/ActionRetryPolicy",
      description: "Retry policy for the action.",
    },
    start_delay: {
      type: "number",
      title: "Start Delay",
      description:
        "Delay before starting the action in seconds. If `wait_until` is also provided, the `wait_until` timer will take precedence.",
      default: 0,
    },
    wait_until: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wait Until",
      description:
        "Wait until a specific date and time before starting. Overrides `start_delay` if both are provided.",
    },
    join_strategy: {
      $ref: "#/components/schemas/JoinStrategy",
      description:
        "The strategy to use when joining on this task. By default, all branches must complete successfully before the join task can complete.",
      default: "all",
    },
    environment: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Environment",
      description:
        "Override environment for this action's execution. Can be a template expression.",
    },
    mask_output: {
      type: "boolean",
      title: "Mask Output",
      description:
        "If true, redact this action's result in workflow execution API responses while preserving internal workflow data flow between actions.",
      default: false,
    },
  },
  type: "object",
  required: ["ref", "action"],
  title: "ActionStatement",
} as const

export const $ActionStep = {
  properties: {
    ref: {
      type: "string",
      title: "Ref",
      description: "The reference of the step",
    },
    action: {
      type: "string",
      title: "Action",
    },
    args: {
      additionalProperties: true,
      type: "object",
      title: "Args",
    },
  },
  type: "object",
  required: ["ref", "action", "args"],
  title: "ActionStep",
} as const

export const $ActionType = {
  properties: {
    component_id: {
      type: "string",
      const: "action-type",
      title: "Component Id",
      default: "action-type",
    },
    multiple: {
      type: "boolean",
      title: "Multiple",
      default: false,
    },
  },
  type: "object",
  title: "ActionType",
} as const

export const $ActionUpdate = {
  properties: {
    title: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Title",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    status: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Status",
    },
    inputs: {
      type: "string",
      maxLength: 300000,
      title: "Inputs",
      default: "",
    },
    control_flow: {
      anyOf: [
        {
          $ref: "#/components/schemas/ActionControlFlow",
        },
        {
          type: "null",
        },
      ],
      mode: "json",
    },
    is_interactive: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Interactive",
    },
    interaction: {
      anyOf: [
        {
          oneOf: [
            {
              $ref: "#/components/schemas/ResponseInteraction",
            },
            {
              $ref: "#/components/schemas/ApprovalInteraction",
            },
          ],
          description: "An interaction configuration",
          discriminator: {
            propertyName: "type",
            mapping: {
              approval: "#/components/schemas/ApprovalInteraction",
              response: "#/components/schemas/ResponseInteraction",
            },
          },
        },
        {
          type: "null",
        },
      ],
      title: "Interaction",
    },
    position_x: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Position X",
    },
    position_y: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Position Y",
    },
    upstream_edges: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ActionEdge",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Upstream Edges",
    },
  },
  type: "object",
  title: "ActionUpdate",
} as const

export const $ActionValidationResult = {
  properties: {
    type: {
      type: "string",
      const: "action",
      title: "Type",
      default: "action",
    },
    status: {
      type: "string",
      enum: ["success", "error"],
      title: "Status",
    },
    msg: {
      type: "string",
      title: "Msg",
      default: "",
    },
    detail: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ValidationDetail",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Detail",
    },
    ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
    },
    action_type: {
      type: "string",
      title: "Action Type",
    },
    validated_args: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Validated Args",
    },
  },
  type: "object",
  required: ["status", "action_type"],
  title: "ActionValidationResult",
  description: "Result of validating a registry action's arguments.",
} as const

export const $AdminOrgInvitationCreate = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_slug: {
      type: "string",
      enum: ["organization-owner", "organization-admin", "organization-member"],
      title: "Role Slug",
      default: "organization-owner",
    },
  },
  type: "object",
  required: ["email"],
  title: "AdminOrgInvitationCreate",
  description:
    "Create an organization invitation from the platform admin console.",
} as const

export const $AdminOrgInvitationCreateResponse = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    role_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Role Slug",
    },
    status: {
      $ref: "#/components/schemas/InvitationStatus",
    },
    invited_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Invited By",
    },
    expires_at: {
      type: "string",
      format: "date-time",
      title: "Expires At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    accepted_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Accepted At",
    },
    created_by_platform_admin: {
      type: "boolean",
      title: "Created By Platform Admin",
    },
    token: {
      type: "string",
      title: "Token",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "email",
    "role_id",
    "role_name",
    "status",
    "invited_by",
    "expires_at",
    "created_at",
    "accepted_at",
    "created_by_platform_admin",
    "token",
  ],
  title: "AdminOrgInvitationCreateResponse",
  description: "Create response containing the raw invitation token.",
} as const

export const $AdminOrgInvitationRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    role_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Role Slug",
    },
    status: {
      $ref: "#/components/schemas/InvitationStatus",
    },
    invited_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Invited By",
    },
    expires_at: {
      type: "string",
      format: "date-time",
      title: "Expires At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    accepted_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Accepted At",
    },
    created_by_platform_admin: {
      type: "boolean",
      title: "Created By Platform Admin",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "email",
    "role_id",
    "role_name",
    "status",
    "invited_by",
    "expires_at",
    "created_at",
    "accepted_at",
    "created_by_platform_admin",
  ],
  title: "AdminOrgInvitationRead",
  description: "Platform-created organization invitation response.",
} as const

export const $AdminOrgInvitationTokenRead = {
  properties: {
    token: {
      type: "string",
      title: "Token",
    },
  },
  type: "object",
  required: ["token"],
  title: "AdminOrgInvitationTokenRead",
  description: "Raw invitation token response.",
} as const

export const $AdminUserCreate = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    password: {
      type: "string",
      title: "Password",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    is_superuser: {
      type: "boolean",
      title: "Is Superuser",
      default: false,
    },
  },
  type: "object",
  required: ["email", "password"],
  title: "AdminUserCreate",
  description: "Create a user from the platform admin control plane.",
} as const

export const $AdminUserRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    role: {
      $ref: "#/components/schemas/UserRole",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
    },
    is_superuser: {
      type: "boolean",
      title: "Is Superuser",
    },
    is_verified: {
      type: "boolean",
      title: "Is Verified",
    },
    last_login_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Login At",
    },
  },
  type: "object",
  required: ["id", "email", "role", "is_active", "is_superuser", "is_verified"],
  title: "AdminUserRead",
  description: "Admin view of a user.",
} as const

export const $AgentCatalogListResponse = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/AgentCatalogRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
    },
  },
  type: "object",
  required: ["items"],
  title: "AgentCatalogListResponse",
  description: "List catalog entries with pagination.",
} as const

export const $AgentCatalogRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    custom_provider_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Custom Provider Id",
    },
    organization_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Organization Id",
    },
    model_provider: {
      type: "string",
      title: "Model Provider",
    },
    model_name: {
      type: "string",
      title: "Model Name",
    },
    model_metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Model Metadata",
    },
  },
  type: "object",
  required: [
    "id",
    "custom_provider_id",
    "organization_id",
    "model_provider",
    "model_name",
    "model_metadata",
  ],
  title: "AgentCatalogRead",
  description: "Single catalog model entry.",
} as const

export const $AgentChannelTokenCreate = {
  properties: {
    agent_preset_id: {
      type: "string",
      format: "uuid",
      title: "Agent Preset Id",
      description: "Preset to link this channel token to",
    },
    channel_type: {
      $ref: "#/components/schemas/ChannelType",
      description: "External channel type",
    },
    config: {
      $ref: "#/components/schemas/SlackChannelTokenConfig",
      description: "Channel-specific configuration payload",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
      description: "Whether this token is active",
      default: true,
    },
  },
  type: "object",
  required: ["agent_preset_id", "channel_type", "config"],
  title: "AgentChannelTokenCreate",
  description: "Request schema for creating an external channel token.",
} as const

export const $AgentChannelTokenRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    agent_preset_id: {
      type: "string",
      format: "uuid",
      title: "Agent Preset Id",
    },
    channel_type: {
      $ref: "#/components/schemas/ChannelType",
    },
    config: {
      $ref: "#/components/schemas/SlackChannelTokenConfig",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
    },
    public_token: {
      type: "string",
      title: "Public Token",
    },
    endpoint_url: {
      type: "string",
      title: "Endpoint Url",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "agent_preset_id",
    "channel_type",
    "config",
    "is_active",
    "public_token",
    "endpoint_url",
    "created_at",
    "updated_at",
  ],
  title: "AgentChannelTokenRead",
  description: "Response schema for an external channel token.",
} as const

export const $AgentChannelTokenUpdate = {
  properties: {
    config: {
      anyOf: [
        {
          $ref: "#/components/schemas/SlackChannelTokenConfig",
        },
        {
          type: "null",
        },
      ],
      description: "Updated channel configuration payload",
    },
    is_active: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Active",
      description: "Activation state",
    },
  },
  type: "object",
  title: "AgentChannelTokenUpdate",
  description: "Request schema for updating an external channel token.",
} as const

export const $AgentCustomProviderCreate = {
  properties: {
    display_name: {
      type: "string",
      maxLength: 200,
      title: "Display Name",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
    },
    passthrough: {
      type: "boolean",
      title: "Passthrough",
      default: false,
    },
    api_key_header: {
      anyOf: [
        {
          type: "string",
          maxLength: 120,
        },
        {
          type: "null",
        },
      ],
      title: "Api Key Header",
    },
    api_key: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Api Key",
    },
    custom_headers: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Custom Headers",
    },
  },
  type: "object",
  required: ["display_name"],
  title: "AgentCustomProviderCreate",
  description: "Create custom LLM provider.",
} as const

export const $AgentCustomProviderListResponse = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/AgentCustomProviderRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
    },
  },
  type: "object",
  required: ["items"],
  title: "AgentCustomProviderListResponse",
  description: "List response with pagination.",
} as const

export const $AgentCustomProviderRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    display_name: {
      type: "string",
      title: "Display Name",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
    },
    passthrough: {
      type: "boolean",
      title: "Passthrough",
    },
    api_key_header: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Api Key Header",
    },
    last_refreshed_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Refreshed At",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "display_name",
    "base_url",
    "passthrough",
    "api_key_header",
    "last_refreshed_at",
  ],
  title: "AgentCustomProviderRead",
  description: "Read custom provider.",
} as const

export const $AgentCustomProviderUpdate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
          maxLength: 200,
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
    },
    passthrough: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Passthrough",
    },
    api_key_header: {
      anyOf: [
        {
          type: "string",
          maxLength: 120,
        },
        {
          type: "null",
        },
      ],
      title: "Api Key Header",
    },
    api_key: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Api Key",
    },
    custom_headers: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Custom Headers",
    },
  },
  type: "object",
  title: "AgentCustomProviderUpdate",
  description: "Update custom provider.",
} as const

export const $AgentFolderCreate = {
  properties: {
    name: {
      type: "string",
      title: "Name",
    },
    parent_path: {
      type: "string",
      title: "Parent Path",
      default: "/",
    },
  },
  type: "object",
  required: ["name"],
  title: "AgentFolderCreate",
} as const

export const $AgentFolderDelete = {
  properties: {
    recursive: {
      type: "boolean",
      title: "Recursive",
      default: false,
    },
  },
  type: "object",
  title: "AgentFolderDelete",
} as const

export const $AgentFolderDirectoryItem = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    path: {
      type: "string",
      title: "Path",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    type: {
      type: "string",
      const: "folder",
      title: "Type",
    },
    num_items: {
      type: "integer",
      title: "Num Items",
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "path",
    "workspace_id",
    "created_at",
    "updated_at",
    "type",
    "num_items",
  ],
  title: "AgentFolderDirectoryItem",
} as const

export const $AgentFolderMove = {
  properties: {
    new_parent_path: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "New Parent Path",
    },
  },
  type: "object",
  title: "AgentFolderMove",
} as const

export const $AgentFolderRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    path: {
      type: "string",
      title: "Path",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: ["id", "name", "path", "workspace_id", "created_at", "updated_at"],
  title: "AgentFolderRead",
} as const

export const $AgentFolderUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
  },
  type: "object",
  title: "AgentFolderUpdate",
} as const

export const $AgentModel = {
  properties: {
    component_id: {
      type: "string",
      const: "agent-model",
      title: "Component Id",
      default: "agent-model",
    },
  },
  type: "object",
  title: "AgentModel",
} as const

export const $AgentModelAccessCreate = {
  properties: {
    catalog_id: {
      type: "string",
      format: "uuid",
      title: "Catalog Id",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
  },
  type: "object",
  required: ["catalog_id"],
  title: "AgentModelAccessCreate",
  description: "Enable a model for org or workspace.",
} as const

export const $AgentModelAccessListResponse = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/AgentModelAccessRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
    },
  },
  type: "object",
  required: ["items"],
  title: "AgentModelAccessListResponse",
  description: "List accessible models with pagination.",
} as const

export const $AgentModelAccessRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
    catalog_id: {
      type: "string",
      format: "uuid",
      title: "Catalog Id",
    },
  },
  type: "object",
  required: ["id", "organization_id", "workspace_id", "catalog_id"],
  title: "AgentModelAccessRead",
  description: "Model access entry.",
} as const

export const $AgentOutput = {
  properties: {
    output: {
      title: "Output",
    },
    message_history: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ChatMessage",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Message History",
    },
    duration: {
      type: "number",
      title: "Duration",
    },
    usage: {
      anyOf: [
        {
          $ref: "#/components/schemas/RunUsage",
        },
        {
          type: "null",
        },
      ],
    },
    session_id: {
      type: "string",
      format: "uuid",
      title: "Session Id",
    },
  },
  type: "object",
  required: ["output", "duration", "session_id"],
  title: "AgentOutput",
} as const

export const $AgentPreset = {
  properties: {
    component_id: {
      type: "string",
      const: "agent-preset",
      title: "Component Id",
      default: "agent-preset",
    },
  },
  type: "object",
  title: "AgentPreset",
} as const

export const $AgentPresetCapability = {
  type: "string",
  enum: ["approvals", "subagents", "internet_access"],
} as const

export const $AgentPresetCreate = {
  properties: {
    instructions: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Instructions",
    },
    model_name: {
      type: "string",
      maxLength: 120,
      minLength: 1,
      title: "Model Name",
    },
    model_provider: {
      type: "string",
      maxLength: 120,
      minLength: 1,
      title: "Model Provider",
    },
    catalog_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Catalog Id",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
    },
    output_type: {
      anyOf: [
        {
          $ref: "#/components/schemas/OutputType",
        },
        {
          type: "null",
        },
      ],
    },
    actions: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Actions",
    },
    namespaces: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Namespaces",
    },
    tool_approvals: {
      anyOf: [
        {
          additionalProperties: {
            type: "boolean",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tool Approvals",
    },
    mcp_integrations: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Mcp Integrations",
    },
    agents: {
      $ref: "#/components/schemas/AgentSubagentsConfig-Input",
    },
    retries: {
      type: "integer",
      minimum: 0,
      title: "Retries",
      default: 3,
    },
    enable_thinking: {
      type: "boolean",
      title: "Enable Thinking",
      default: true,
    },
    enable_internet_access: {
      type: "boolean",
      title: "Enable Internet Access",
      default: false,
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    skills: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/AgentPresetSkillBindingBase",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Skills",
    },
    name: {
      type: "string",
      maxLength: 120,
      minLength: 1,
      title: "Name",
    },
    slug: {
      anyOf: [
        {
          type: "string",
          maxLength: 160,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Slug",
    },
  },
  type: "object",
  required: ["model_name", "model_provider", "name"],
  title: "AgentPresetCreate",
  description: "Payload for creating a new agent preset.",
} as const

export const $AgentPresetDirectoryItem = {
  properties: {
    type: {
      type: "string",
      const: "preset",
      title: "Type",
    },
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    slug: {
      type: "string",
      title: "Slug",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    model_provider: {
      type: "string",
      title: "Model Provider",
    },
    model_name: {
      type: "string",
      title: "Model Name",
    },
    folder_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Folder Id",
    },
    tags: {
      items: {
        $ref: "#/components/schemas/TagRead",
      },
      type: "array",
      title: "Tags",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "type",
    "id",
    "name",
    "slug",
    "description",
    "model_provider",
    "model_name",
    "folder_id",
    "tags",
    "created_at",
    "updated_at",
  ],
  title: "AgentPresetDirectoryItem",
  description: "Agent preset as a directory item.",
} as const

export const $AgentPresetMoveToFolder = {
  properties: {
    folder_path: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Folder Path",
    },
  },
  type: "object",
  title: "AgentPresetMoveToFolder",
  description: "Payload for moving an agent preset to a folder.",
} as const

export const $AgentPresetRead = {
  properties: {
    instructions: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Instructions",
    },
    model_name: {
      type: "string",
      maxLength: 120,
      title: "Model Name",
    },
    model_provider: {
      type: "string",
      maxLength: 120,
      title: "Model Provider",
    },
    catalog_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Catalog Id",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
    },
    output_type: {
      anyOf: [
        {
          $ref: "#/components/schemas/OutputType",
        },
        {
          type: "null",
        },
      ],
    },
    actions: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Actions",
    },
    namespaces: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Namespaces",
    },
    tool_approvals: {
      anyOf: [
        {
          additionalProperties: {
            type: "boolean",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tool Approvals",
    },
    mcp_integrations: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Mcp Integrations",
    },
    agents: {
      $ref: "#/components/schemas/AgentSubagentsConfig-Output",
    },
    retries: {
      type: "integer",
      minimum: 0,
      title: "Retries",
      default: 3,
    },
    enable_thinking: {
      type: "boolean",
      title: "Enable Thinking",
      default: true,
    },
    enable_internet_access: {
      type: "boolean",
      title: "Enable Internet Access",
      default: false,
    },
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    slug: {
      type: "string",
      title: "Slug",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
    skills: {
      items: {
        $ref: "#/components/schemas/AgentPresetSkillBindingRead",
      },
      type: "array",
      title: "Skills",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "model_name",
    "model_provider",
    "id",
    "workspace_id",
    "name",
    "slug",
    "created_at",
    "updated_at",
  ],
  title: "AgentPresetRead",
  description: "API model for reading agent presets.",
} as const

export const $AgentPresetReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    slug: {
      type: "string",
      title: "Slug",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    model_provider: {
      type: "string",
      title: "Model Provider",
    },
    model_name: {
      type: "string",
      title: "Model Name",
    },
    folder_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Folder Id",
    },
    tags: {
      items: {
        $ref: "#/components/schemas/TagRead",
      },
      type: "array",
      title: "Tags",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
    capabilities: {
      items: {
        $ref: "#/components/schemas/AgentPresetCapability",
      },
      type: "array",
      title: "Capabilities",
    },
    current_version_subagent_eligibility: {
      $ref: "#/components/schemas/AgentPresetSubagentEligibility",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "name",
    "slug",
    "description",
    "model_provider",
    "model_name",
    "created_at",
    "updated_at",
  ],
  title: "AgentPresetReadMinimal",
  description: "Minimal API model for reading agent presets in list endpoints.",
} as const

export const $AgentPresetSkillBindingBase = {
  properties: {
    skill_id: {
      type: "string",
      format: "uuid",
      title: "Skill Id",
    },
    skill_version_id: {
      type: "string",
      format: "uuid",
      title: "Skill Version Id",
    },
  },
  type: "object",
  required: ["skill_id", "skill_version_id"],
  title: "AgentPresetSkillBindingBase",
  description: "Shared fields for preset skill bindings.",
} as const

export const $AgentPresetSkillBindingChange = {
  properties: {
    skill_id: {
      type: "string",
      format: "uuid",
      title: "Skill Id",
    },
    skill_name: {
      type: "string",
      title: "Skill Name",
    },
    old_skill_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Old Skill Version Id",
    },
    old_skill_version: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Old Skill Version",
    },
    new_skill_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "New Skill Version Id",
    },
    new_skill_version: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "New Skill Version",
    },
  },
  type: "object",
  required: ["skill_id", "skill_name"],
  title: "AgentPresetSkillBindingChange",
  description: "Diff entry for skill binding changes between preset versions.",
} as const

export const $AgentPresetSkillBindingRead = {
  properties: {
    skill_id: {
      type: "string",
      format: "uuid",
      title: "Skill Id",
    },
    skill_version_id: {
      type: "string",
      format: "uuid",
      title: "Skill Version Id",
    },
    skill_name: {
      type: "string",
      title: "Skill Name",
    },
    skill_version: {
      type: "integer",
      title: "Skill Version",
    },
  },
  type: "object",
  required: ["skill_id", "skill_version_id", "skill_name", "skill_version"],
  title: "AgentPresetSkillBindingRead",
  description: "Resolved preset skill binding with metadata.",
} as const

export const $AgentPresetSubagentEligibility = {
  properties: {
    eligible: {
      type: "boolean",
      title: "Eligible",
      default: true,
    },
    reasons: {
      items: {
        $ref: "#/components/schemas/AgentPresetSubagentEligibilityReason",
      },
      type: "array",
      title: "Reasons",
    },
    message: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Message",
    },
  },
  type: "object",
  title: "AgentPresetSubagentEligibility",
  description:
    "Whether a preset version can be attached as a preset-backed subagent.",
} as const

export const $AgentPresetSubagentEligibilityReason = {
  type: "string",
  enum: ["agents_enabled", "tool_approvals"],
} as const

export const $AgentPresetTagCreate = {
  properties: {
    tag_id: {
      type: "string",
      format: "uuid",
      title: "Tag Id",
    },
  },
  type: "object",
  required: ["tag_id"],
  title: "AgentPresetTagCreate",
  description: "Payload for adding a tag to an agent preset.",
} as const

export const $AgentPresetUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 120,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    slug: {
      anyOf: [
        {
          type: "string",
          maxLength: 160,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Slug",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    instructions: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Instructions",
    },
    model_name: {
      anyOf: [
        {
          type: "string",
          maxLength: 120,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Model Name",
    },
    model_provider: {
      anyOf: [
        {
          type: "string",
          maxLength: 120,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Model Provider",
    },
    catalog_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Catalog Id",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
    },
    output_type: {
      anyOf: [
        {
          $ref: "#/components/schemas/OutputType",
        },
        {
          type: "null",
        },
      ],
    },
    actions: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Actions",
    },
    namespaces: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Namespaces",
    },
    tool_approvals: {
      anyOf: [
        {
          additionalProperties: {
            type: "boolean",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tool Approvals",
    },
    mcp_integrations: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Mcp Integrations",
    },
    agents: {
      anyOf: [
        {
          $ref: "#/components/schemas/AgentSubagentsConfig-Input",
        },
        {
          type: "null",
        },
      ],
    },
    retries: {
      anyOf: [
        {
          type: "integer",
          minimum: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Retries",
    },
    enable_thinking: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Enable Thinking",
    },
    enable_internet_access: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Enable Internet Access",
    },
    skills: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/AgentPresetSkillBindingBase",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Skills",
    },
  },
  type: "object",
  title: "AgentPresetUpdate",
  description: "Payload for updating an existing agent preset.",
} as const

export const $AgentPresetVersionDiff = {
  properties: {
    base_version_id: {
      type: "string",
      format: "uuid",
      title: "Base Version Id",
    },
    base_version: {
      type: "integer",
      title: "Base Version",
    },
    compare_version_id: {
      type: "string",
      format: "uuid",
      title: "Compare Version Id",
    },
    compare_version: {
      type: "integer",
      title: "Compare Version",
    },
    instructions_changed: {
      type: "boolean",
      title: "Instructions Changed",
      default: false,
    },
    base_instructions: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Base Instructions",
    },
    compare_instructions: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Compare Instructions",
    },
    scalar_changes: {
      items: {
        $ref: "#/components/schemas/ScalarFieldChange",
      },
      type: "array",
      title: "Scalar Changes",
    },
    list_changes: {
      items: {
        $ref: "#/components/schemas/StringListFieldChange",
      },
      type: "array",
      title: "List Changes",
    },
    tool_approval_changes: {
      items: {
        $ref: "#/components/schemas/ToolApprovalFieldChange",
      },
      type: "array",
      title: "Tool Approval Changes",
    },
    skill_changes: {
      items: {
        $ref: "#/components/schemas/AgentPresetSkillBindingChange",
      },
      type: "array",
      title: "Skill Changes",
    },
    total_changes: {
      type: "integer",
      title: "Total Changes",
      default: 0,
    },
  },
  type: "object",
  required: [
    "base_version_id",
    "base_version",
    "compare_version_id",
    "compare_version",
  ],
  title: "AgentPresetVersionDiff",
  description: "Structured diff between two preset versions.",
} as const

export const $AgentPresetVersionRead = {
  properties: {
    instructions: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Instructions",
    },
    model_name: {
      type: "string",
      maxLength: 120,
      title: "Model Name",
    },
    model_provider: {
      type: "string",
      maxLength: 120,
      title: "Model Provider",
    },
    catalog_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Catalog Id",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
    },
    output_type: {
      anyOf: [
        {
          $ref: "#/components/schemas/OutputType",
        },
        {
          type: "null",
        },
      ],
    },
    actions: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Actions",
    },
    namespaces: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Namespaces",
    },
    tool_approvals: {
      anyOf: [
        {
          additionalProperties: {
            type: "boolean",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tool Approvals",
    },
    mcp_integrations: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Mcp Integrations",
    },
    agents: {
      $ref: "#/components/schemas/AgentSubagentsConfig-Output",
    },
    retries: {
      type: "integer",
      minimum: 0,
      title: "Retries",
      default: 3,
    },
    enable_thinking: {
      type: "boolean",
      title: "Enable Thinking",
      default: true,
    },
    enable_internet_access: {
      type: "boolean",
      title: "Enable Internet Access",
      default: false,
    },
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    preset_id: {
      type: "string",
      format: "uuid",
      title: "Preset Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    version: {
      type: "integer",
      title: "Version",
    },
    capabilities: {
      items: {
        $ref: "#/components/schemas/AgentPresetCapability",
      },
      type: "array",
      title: "Capabilities",
    },
    subagent_eligibility: {
      $ref: "#/components/schemas/AgentPresetSubagentEligibility",
    },
    skills: {
      items: {
        $ref: "#/components/schemas/AgentPresetSkillBindingRead",
      },
      type: "array",
      title: "Skills",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "model_name",
    "model_provider",
    "id",
    "preset_id",
    "workspace_id",
    "version",
    "created_at",
    "updated_at",
  ],
  title: "AgentPresetVersionRead",
  description: "Full response model for an immutable preset version.",
} as const

export const $AgentPresetVersionReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    preset_id: {
      type: "string",
      format: "uuid",
      title: "Preset Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    version: {
      type: "integer",
      title: "Version",
    },
    capabilities: {
      items: {
        $ref: "#/components/schemas/AgentPresetCapability",
      },
      type: "array",
      title: "Capabilities",
    },
    subagent_eligibility: {
      $ref: "#/components/schemas/AgentPresetSubagentEligibility",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "preset_id",
    "workspace_id",
    "version",
    "created_at",
    "updated_at",
  ],
  title: "AgentPresetVersionReadMinimal",
  description: "Metadata returned when listing immutable preset versions.",
} as const

export const $AgentSessionCreate = {
  properties: {
    id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Id",
      description: "Session ID. If not provided, service generates one.",
    },
    title: {
      type: "string",
      maxLength: 200,
      minLength: 1,
      title: "Title",
      description: "Human-readable title for the session",
      default: "New Chat",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
      description: "User who created this session",
    },
    entity_type: {
      $ref: "#/components/schemas/AgentSessionEntity",
      description: "Type of entity this session is associated with",
    },
    entity_id: {
      type: "string",
      format: "uuid",
      title: "Entity Id",
      description: "ID of the associated entity",
    },
    tools: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
          maxItems: 50,
        },
        {
          type: "null",
        },
      ],
      title: "Tools",
      description: "Tools available to the agent for this session",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
      description: "Agent preset used for this session (if any)",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
      description:
        "Pinned preset version used for this session. If null, the session follows the preset's current version.",
    },
    harness_type: {
      $ref: "#/components/schemas/HarnessType",
      description: "Agent harness type",
      default: "claude_code",
    },
  },
  type: "object",
  required: ["entity_type", "entity_id"],
  title: "AgentSessionCreate",
  description: "Request schema for creating an agent session.",
} as const

export const $AgentSessionEntity = {
  type: "string",
  enum: [
    "case",
    "agent_preset",
    "agent_preset_builder",
    "copilot",
    "workflow",
    "approval",
    "external_channel",
  ],
  title: "AgentSessionEntity",
  description: `The type of entity associated with an agent session.

Determines the context and behavior of the session:
- CASE: Chat attached to a Case entity for investigation
- AGENT_PRESET: Live chat testing a preset configuration
- AGENT_PRESET_BUILDER: Builder chat for editing/configuring a preset
- COPILOT: Workspace-level copilot assistant
- WORKFLOW: Workflow-initiated agent run (from action)
- APPROVAL: Inbox approval continuation (hidden from main chat list)
- EXTERNAL_CHANNEL: External channel session (e.g. Slack thread)`,
} as const

export const $AgentSessionForkRequest = {
  properties: {
    entity_type: {
      anyOf: [
        {
          $ref: "#/components/schemas/AgentSessionEntity",
        },
        {
          type: "null",
        },
      ],
      description:
        "Override entity type for the forked session. Use 'approval' for inbox forks to hide from main chat list.",
    },
  },
  type: "object",
  title: "AgentSessionForkRequest",
  description: "Request schema for forking an agent session.",
} as const

export const $AgentSessionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
    },
    entity_type: {
      type: "string",
      title: "Entity Type",
    },
    entity_id: {
      type: "string",
      format: "uuid",
      title: "Entity Id",
    },
    channel_context: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Channel Context",
    },
    tools: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Tools",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
    },
    agents_binding: {
      anyOf: [
        {
          $ref: "#/components/schemas/ResolvedAgentsConfig",
        },
        {
          type: "null",
        },
      ],
    },
    harness_type: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Harness Type",
    },
    last_stream_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Stream Id",
    },
    parent_session_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Session Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "title",
    "created_by",
    "entity_type",
    "entity_id",
    "channel_context",
    "tools",
    "agent_preset_id",
    "agent_preset_version_id",
    "harness_type",
    "created_at",
    "updated_at",
  ],
  title: "AgentSessionRead",
  description: "Response schema for agent session.",
} as const

export const $AgentSessionReadVercel = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
    },
    entity_type: {
      type: "string",
      title: "Entity Type",
    },
    entity_id: {
      type: "string",
      format: "uuid",
      title: "Entity Id",
    },
    channel_context: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Channel Context",
    },
    tools: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Tools",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
    },
    agents_binding: {
      anyOf: [
        {
          $ref: "#/components/schemas/ResolvedAgentsConfig",
        },
        {
          type: "null",
        },
      ],
    },
    harness_type: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Harness Type",
    },
    last_stream_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Stream Id",
    },
    parent_session_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Session Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    messages: {
      items: {
        $ref: "#/components/schemas/UIMessage",
      },
      type: "array",
      title: "Messages",
      description: "Session messages in Vercel UI format",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "title",
    "created_by",
    "entity_type",
    "entity_id",
    "channel_context",
    "tools",
    "agent_preset_id",
    "agent_preset_version_id",
    "harness_type",
    "created_at",
    "updated_at",
  ],
  title: "AgentSessionReadVercel",
  description: "Response schema for agent session with Vercel format messages.",
} as const

export const $AgentSessionReadWithMessages = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
    },
    entity_type: {
      type: "string",
      title: "Entity Type",
    },
    entity_id: {
      type: "string",
      format: "uuid",
      title: "Entity Id",
    },
    channel_context: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Channel Context",
    },
    tools: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Tools",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
    },
    agents_binding: {
      anyOf: [
        {
          $ref: "#/components/schemas/ResolvedAgentsConfig",
        },
        {
          type: "null",
        },
      ],
    },
    harness_type: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Harness Type",
    },
    last_stream_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Stream Id",
    },
    parent_session_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Session Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    messages: {
      items: {},
      type: "array",
      title: "Messages",
      description: "Session messages",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "title",
    "created_by",
    "entity_type",
    "entity_id",
    "channel_context",
    "tools",
    "agent_preset_id",
    "agent_preset_version_id",
    "harness_type",
    "created_at",
    "updated_at",
  ],
  title: "AgentSessionReadWithMessages",
  description: "Response schema for agent session with message history.",
} as const

export const $AgentSessionUpdate = {
  properties: {
    title: {
      anyOf: [
        {
          type: "string",
          maxLength: 200,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Title",
      description: "Session title",
    },
    tools: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
          maxItems: 50,
        },
        {
          type: "null",
        },
      ],
      title: "Tools",
      description: "Tools available to the agent",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
      description: "Agent preset to use for this session",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
      description:
        "Pinned preset version to use for this session. Set null to follow the preset's current version.",
    },
    harness_type: {
      anyOf: [
        {
          $ref: "#/components/schemas/HarnessType",
        },
        {
          type: "null",
        },
      ],
      description: "Agent harness type",
    },
  },
  type: "object",
  title: "AgentSessionUpdate",
  description: "Request schema for updating an agent session.",
} as const

export const $AgentSettingsRead = {
  properties: {
    agent_default_model: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Default Model",
    },
    agent_fixed_args: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Fixed Args",
    },
    agent_case_chat_prompt: {
      type: "string",
      title: "Agent Case Chat Prompt",
    },
    agent_case_chat_inject_content: {
      type: "boolean",
      title: "Agent Case Chat Inject Content",
    },
  },
  type: "object",
  required: [
    "agent_default_model",
    "agent_fixed_args",
    "agent_case_chat_prompt",
    "agent_case_chat_inject_content",
  ],
  title: "AgentSettingsRead",
} as const

export const $AgentSettingsUpdate = {
  properties: {
    agent_default_model: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Default Model",
      description: "The default AI model to use for agent operations.",
    },
    agent_fixed_args: {
      anyOf: [
        {
          type: "string",
          maxLength: 10000,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Agent Fixed Args",
      description:
        "Fixed arguments for agent tools as a JSON string. Format: {'tool_name': {'arg': 'value'}}",
    },
    agent_case_chat_prompt: {
      type: "string",
      title: "Agent Case Chat Prompt",
      description:
        "Additional instructions for case chat agent; prepended to UI-provided instructions.",
      default: "",
    },
    agent_case_chat_inject_content: {
      type: "boolean",
      title: "Agent Case Chat Inject Content",
      description:
        "Whether to automatically inject case content into agent prompts when a case_id is available.",
      default: false,
    },
  },
  type: "object",
  title: "AgentSettingsUpdate",
} as const

export const $AgentSubagentsConfig_Input = {
  properties: {
    enabled: {
      type: "boolean",
      title: "Enabled",
      default: false,
    },
    subagents: {
      items: {
        $ref: "#/components/schemas/AnyAttachedSubagentRef",
      },
      type: "array",
      title: "Subagents",
    },
  },
  additionalProperties: false,
  type: "object",
  title: "AgentSubagentsConfig",
  description:
    "User-facing agents toggle and optional preset-backed subagents.",
} as const

export const $AgentSubagentsConfig_Output = {
  properties: {
    enabled: {
      type: "boolean",
      title: "Enabled",
      default: false,
    },
    subagents: {
      items: {
        $ref: "#/components/schemas/AnyAttachedSubagentRef",
      },
      type: "array",
      title: "Subagents",
    },
  },
  additionalProperties: false,
  type: "object",
  title: "AgentSubagentsConfig",
  description:
    "User-facing agents toggle and optional preset-backed subagents.",
} as const

export const $AgentTagRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    ref: {
      type: "string",
      title: "Ref",
    },
    color: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Color",
    },
  },
  type: "object",
  required: ["id", "name", "ref", "color"],
  title: "AgentTagRead",
  description: "Tag data.",
} as const

export const $AnyAttachedSubagentRef = {
  anyOf: [
    {
      $ref: "#/components/schemas/ResolvedAttachedSubagentRef",
    },
    {
      $ref: "#/components/schemas/AttachedSubagentRef",
    },
  ],
} as const

export const $AppSettingsRead = {
  properties: {
    app_registry_validation_enabled: {
      type: "boolean",
      title: "App Registry Validation Enabled",
    },
    app_executions_query_limit: {
      type: "integer",
      title: "App Executions Query Limit",
    },
    app_interactions_enabled: {
      type: "boolean",
      title: "App Interactions Enabled",
    },
    app_workflow_export_enabled: {
      type: "boolean",
      title: "App Workflow Export Enabled",
    },
    app_create_workspace_on_register: {
      type: "boolean",
      title: "App Create Workspace On Register",
    },
    app_action_form_mode_enabled: {
      type: "boolean",
      title: "App Action Form Mode Enabled",
    },
  },
  type: "object",
  required: [
    "app_registry_validation_enabled",
    "app_executions_query_limit",
    "app_interactions_enabled",
    "app_workflow_export_enabled",
    "app_create_workspace_on_register",
    "app_action_form_mode_enabled",
  ],
  title: "AppSettingsRead",
  description: "Settings for the app.",
} as const

export const $AppSettingsUpdate = {
  properties: {
    app_registry_validation_enabled: {
      type: "boolean",
      title: "App Registry Validation Enabled",
      description: "Whether registry validation is enabled.",
      default: false,
    },
    app_executions_query_limit: {
      type: "integer",
      title: "App Executions Query Limit",
      description:
        "The maximum number of executions to return in a single query.",
      default: 100,
    },
    app_interactions_enabled: {
      type: "boolean",
      title: "App Interactions Enabled",
      description: "Whether app interactions are enabled.",
      default: false,
    },
    app_workflow_export_enabled: {
      type: "boolean",
      title: "App Workflow Export Enabled",
      description: "Whether workflow exports are enabled.",
      default: true,
    },
    app_create_workspace_on_register: {
      type: "boolean",
      title: "App Create Workspace On Register",
      description:
        "Whether to automatically create a workspace when a user signs up.",
      default: false,
    },
    app_action_form_mode_enabled: {
      type: "boolean",
      title: "App Action Form Mode Enabled",
      description:
        "Whether to enable form mode for action inputs. When disabled, only YAML mode is available, preserving raw YAML formatting.",
      default: true,
    },
  },
  type: "object",
  title: "AppSettingsUpdate",
  description: "Settings for OAuth authentication.",
} as const

export const $ApprovalDecision = {
  properties: {
    tool_call_id: {
      type: "string",
      title: "Tool Call Id",
    },
    action: {
      type: "string",
      enum: ["approve", "override", "deny"],
      title: "Action",
    },
    override_args: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Override Args",
    },
    reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Reason",
    },
    metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Metadata",
      description:
        "Optional metadata captured with the decision (e.g. external actor identity).",
    },
  },
  type: "object",
  required: ["tool_call_id", "action"],
  title: "ApprovalDecision",
  description: "Operator decision for a pending approval.",
} as const

export const $ApprovalInteraction = {
  properties: {
    type: {
      type: "string",
      const: "approval",
      title: "Type",
    },
    timeout: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Timeout",
      description: "The timeout for the interaction in seconds.",
    },
    required_approvers: {
      type: "integer",
      title: "Required Approvers",
      description:
        "Number of approvers required before the action can proceed.",
      default: 1,
    },
    approver_groups: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Approver Groups",
      description: "List of groups that are allowed to approve this action.",
    },
    message: {
      type: "string",
      title: "Message",
      description: "Custom message to display to approvers.",
      default: "",
    },
    approve_if: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Approve If",
      description: "Condition to approve the action.",
    },
  },
  type: "object",
  required: ["type"],
  title: "ApprovalInteraction",
  description: "Configuration for an approval interaction.",
} as const

export const $ApprovalMap = {
  additionalProperties: {
    anyOf: [
      {
        type: "boolean",
      },
      {
        oneOf: [
          {
            $ref: "#/components/schemas/ToolApproved",
          },
          {
            $ref: "#/components/schemas/ToolDenied",
          },
        ],
        discriminator: {
          propertyName: "kind",
          mapping: {
            "tool-approved": "#/components/schemas/ToolApproved",
            "tool-denied": "#/components/schemas/ToolDenied",
          },
        },
      },
    ],
  },
  type: "object",
} as const

export const $ApprovalRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    tool_call_id: {
      type: "string",
      title: "Tool Call Id",
    },
    tool_name: {
      type: "string",
      title: "Tool Name",
    },
    tool_call_args: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tool Call Args",
    },
    status: {
      $ref: "#/components/schemas/ApprovalStatus",
    },
    reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Reason",
    },
    decision: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Decision",
    },
    approved_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Approved By",
    },
    approved_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Approved At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
  },
  type: "object",
  required: ["id", "tool_call_id", "tool_name", "status", "created_at"],
  title: "ApprovalRead",
  description: "Response schema for approval data in chat timeline.",
} as const

export const $ApprovalStatus = {
  type: "string",
  enum: ["pending", "approved", "rejected"],
  title: "ApprovalStatus",
  description: "Possible states for a deferred tool approval.",
} as const

export const $ApprovalSubmission = {
  properties: {
    approvals: {
      $ref: "#/components/schemas/ApprovalMap",
    },
  },
  type: "object",
  required: ["approvals"],
  title: "ApprovalSubmission",
  description: "Request model for submitting approval decisions.",
} as const

export const $AssigneeChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "assignee_changed",
      title: "Type",
      default: "assignee_changed",
    },
    old: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Old",
    },
    new: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "New",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["old", "new", "created_at"],
  title: "AssigneeChangedEventRead",
  description: "Event for when a case assignee is changed.",
} as const

export const $AssistantMessage = {
  properties: {
    content: {
      items: {
        anyOf: [
          {
            $ref: "#/components/schemas/TextBlock",
          },
          {
            $ref: "#/components/schemas/ThinkingBlock",
          },
          {
            $ref: "#/components/schemas/ToolUseBlock",
          },
          {
            $ref: "#/components/schemas/ToolResultBlock",
          },
        ],
      },
      type: "array",
      title: "Content",
    },
    model: {
      type: "string",
      title: "Model",
    },
    parent_tool_use_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Tool Use Id",
    },
    error: {
      anyOf: [
        {
          type: "string",
          enum: [
            "authentication_failed",
            "billing_error",
            "rate_limit",
            "invalid_request",
            "server_error",
            "unknown",
          ],
        },
        {
          type: "null",
        },
      ],
      title: "Error",
    },
    usage: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Usage",
    },
    message_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Message Id",
    },
    stop_reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Stop Reason",
    },
    session_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Session Id",
    },
    uuid: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Uuid",
    },
  },
  type: "object",
  required: ["content", "model"],
  title: "AssistantMessage",
} as const

export const $AttachedSubagentRef = {
  properties: {
    preset: {
      type: "string",
      maxLength: 160,
      minLength: 1,
      title: "Preset",
    },
    preset_version: {
      anyOf: [
        {
          type: "integer",
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Preset Version",
    },
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 80,
          minLength: 1,
          pattern: "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$",
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    max_turns: {
      anyOf: [
        {
          type: "integer",
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Max Turns",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["preset"],
  title: "AttachedSubagentRef",
  description: "User-facing reference to a preset-backed subagent.",
} as const

export const $AttachmentCreatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "attachment_created",
      title: "Type",
      default: "attachment_created",
    },
    attachment_id: {
      type: "string",
      format: "uuid",
      title: "Attachment Id",
    },
    file_name: {
      type: "string",
      title: "File Name",
    },
    content_type: {
      type: "string",
      title: "Content Type",
    },
    size: {
      type: "integer",
      title: "Size",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: [
    "attachment_id",
    "file_name",
    "content_type",
    "size",
    "created_at",
  ],
  title: "AttachmentCreatedEventRead",
  description: "Event for when an attachment is created for a case.",
} as const

export const $AttachmentDeletedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "attachment_deleted",
      title: "Type",
      default: "attachment_deleted",
    },
    attachment_id: {
      type: "string",
      format: "uuid",
      title: "Attachment Id",
    },
    file_name: {
      type: "string",
      title: "File Name",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["attachment_id", "file_name", "created_at"],
  title: "AttachmentDeletedEventRead",
  description: "Event for when an attachment is deleted from a case.",
} as const

export const $AudioUrl = {
  properties: {
    url: {
      type: "string",
      title: "Url",
    },
    force_download: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "string",
          const: "allow-local",
        },
      ],
      title: "Force Download",
      default: false,
    },
    vendor_metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Vendor Metadata",
    },
    kind: {
      type: "string",
      const: "audio-url",
      title: "Kind",
      default: "audio-url",
    },
    media_type: {
      type: "string",
      title: "Media Type",
      description:
        "Return the media type of the file, based on the URL or the provided `media_type`.",
      readOnly: true,
    },
    identifier: {
      type: "string",
      title: "Identifier",
      description: `The identifier of the file, such as a unique ID.

This identifier can be provided to the model in a message to allow it to refer to this file in a tool call argument,
and the tool can look up the file in question by iterating over the message history and finding the matching \`FileUrl\`.

This identifier is only automatically passed to the model when the \`FileUrl\` is returned by a tool.
If you're passing the \`FileUrl\` as a user message, it's up to you to include a separate text part with the identifier,
e.g. "This is file <identifier>:" preceding the \`FileUrl\`.

It's also included in inline-text delimiters for providers that require inlining text documents, so the model can
distinguish multiple files.`,
      readOnly: true,
    },
  },
  type: "object",
  required: ["url", "media_type", "identifier"],
  title: "AudioUrl",
  description: "A URL to an audio file.",
} as const

export const $AuditSettingsRead = {
  properties: {
    audit_webhook_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Url",
    },
    audit_webhook_custom_headers: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Custom Headers",
    },
    audit_webhook_custom_payload: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Custom Payload",
    },
    audit_webhook_payload_attribute: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Payload Attribute",
    },
    audit_webhook_verify_ssl: {
      type: "boolean",
      title: "Audit Webhook Verify Ssl",
      default: true,
    },
    decryption_failed_keys: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Decryption Failed Keys",
      description:
        "Encrypted setting keys that could not be decrypted with the current encryption key and must be reconfigured.",
    },
  },
  type: "object",
  required: ["audit_webhook_url"],
  title: "AuditSettingsRead",
  description: "Settings for audit logging.",
} as const

export const $AuditSettingsUpdate = {
  properties: {
    audit_webhook_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Url",
      description:
        "Webhook URL that receives streamed audit events. When unset, audit events are skipped.",
    },
    audit_webhook_custom_headers: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Custom Headers",
      description:
        "Custom headers to include in audit webhook requests. Header names are case-insensitive.",
    },
    audit_webhook_custom_payload: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Custom Payload",
      description:
        "Custom JSON payload merged into streamed audit event payloads. Custom keys override default audit event keys.",
    },
    audit_webhook_payload_attribute: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Audit Webhook Payload Attribute",
      description:
        "Optional wrapper key for audit payloads. When set to a value like 'event', payload is sent as {'event': <audit_payload>}.",
    },
    audit_webhook_verify_ssl: {
      type: "boolean",
      title: "Audit Webhook Verify Ssl",
      description:
        "Whether TLS certificates are verified for webhook requests. Disable only for trusted on-prem/self-signed endpoints.",
      default: true,
    },
  },
  type: "object",
  title: "AuditSettingsUpdate",
  description: "Settings for audit logging.",
} as const

export const $AuthDiscoverRequest = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    org: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Org",
    },
  },
  type: "object",
  required: ["email"],
  title: "AuthDiscoverRequest",
  description: "Request payload for pre-auth discovery.",
} as const

export const $AuthDiscoverResponse = {
  properties: {
    method: {
      $ref: "#/components/schemas/AuthDiscoveryMethod",
    },
    next_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Url",
    },
    organization_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Organization Slug",
    },
  },
  type: "object",
  required: ["method"],
  title: "AuthDiscoverResponse",
  description: "Pre-auth routing hint response.",
} as const

export const $AuthDiscoveryMethod = {
  type: "string",
  enum: ["basic", "oidc", "saml"],
  title: "AuthDiscoveryMethod",
  description: "Authentication method hint for client-side routing.",
} as const

export const $AwsAssumeRoleAccessRead = {
  properties: {
    tracecat_aws_account_id: {
      type: "string",
      title: "Tracecat Aws Account Id",
    },
    tracecat_aws_principal_arn: {
      type: "string",
      title: "Tracecat Aws Principal Arn",
    },
    external_id: {
      type: "string",
      title: "External Id",
    },
  },
  type: "object",
  required: [
    "tracecat_aws_account_id",
    "tracecat_aws_principal_arn",
    "external_id",
  ],
  title: "AwsAssumeRoleAccessRead",
  description:
    "Workspace-scoped AWS AssumeRole details shown in the credentials UI.",
} as const

export const $AzureAICatalogCreate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "azure_ai",
      title: "Model Provider",
    },
    model_name: {
      type: "string",
      maxLength: 500,
      minLength: 1,
      title: "Model Name",
    },
    azure_ai_model_name: {
      type: "string",
      minLength: 1,
      title: "Azure Ai Model Name",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider", "model_name", "azure_ai_model_name"],
  title: "AzureAICatalogCreate",
  description: "Azure AI catalog entry.",
} as const

export const $AzureAICatalogUpdate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "azure_ai",
      title: "Model Provider",
    },
    azure_ai_model_name: {
      type: "string",
      minLength: 1,
      title: "Azure Ai Model Name",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider", "azure_ai_model_name"],
  title: "AzureAICatalogUpdate",
} as const

export const $AzureOpenAICatalogCreate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "azure_openai",
      title: "Model Provider",
    },
    model_name: {
      type: "string",
      maxLength: 500,
      minLength: 1,
      title: "Model Name",
    },
    deployment_name: {
      type: "string",
      minLength: 1,
      title: "Deployment Name",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider", "model_name", "deployment_name"],
  title: "AzureOpenAICatalogCreate",
  description: "Azure OpenAI catalog entry.",
} as const

export const $AzureOpenAICatalogUpdate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "azure_openai",
      title: "Model Provider",
    },
    deployment_name: {
      type: "string",
      minLength: 1,
      title: "Deployment Name",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider", "deployment_name"],
  title: "AzureOpenAICatalogUpdate",
} as const

export const $BatchPositionUpdate = {
  properties: {
    actions: {
      items: {
        $ref: "#/components/schemas/ActionPositionUpdate",
      },
      type: "array",
      title: "Actions",
    },
    trigger_position: {
      anyOf: [
        {
          $ref: "#/components/schemas/Position",
        },
        {
          type: "null",
        },
      ],
    },
  },
  type: "object",
  title: "BatchPositionUpdate",
  description: "Batch update for action and trigger positions.",
} as const

export const $BedrockCatalogCreate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "bedrock",
      title: "Model Provider",
    },
    model_name: {
      type: "string",
      maxLength: 500,
      minLength: 1,
      title: "Model Name",
    },
    inference_profile_id: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Inference Profile Id",
    },
    model_id: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Model Id",
    },
    use_converse: {
      type: "boolean",
      title: "Use Converse",
      default: false,
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider", "model_name"],
  title: "BedrockCatalogCreate",
  description:
    "Bedrock catalog entry. Requires exactly one of inference_profile_id or model_id.",
} as const

export const $BedrockCatalogUpdate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "bedrock",
      title: "Model Provider",
    },
    inference_profile_id: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Inference Profile Id",
    },
    model_id: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Model Id",
    },
    use_converse: {
      type: "boolean",
      title: "Use Converse",
      default: false,
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider"],
  title: "BedrockCatalogUpdate",
} as const

export const $BinaryContent = {
  properties: {
    data: {
      type: "string",
      format: "base64url",
      title: "Data",
    },
    media_type: {
      anyOf: [
        {
          type: "string",
          enum: [
            "audio/wav",
            "audio/mpeg",
            "audio/ogg",
            "audio/flac",
            "audio/aiff",
            "audio/aac",
          ],
        },
        {
          type: "string",
          enum: ["image/jpeg", "image/png", "image/gif", "image/webp"],
        },
        {
          type: "string",
          enum: [
            "application/pdf",
            "text/plain",
            "text/csv",
            "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
            "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
            "text/html",
            "text/markdown",
            "application/msword",
            "application/vnd.ms-excel",
          ],
        },
        {
          type: "string",
        },
      ],
      title: "Media Type",
    },
    vendor_metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Vendor Metadata",
    },
    kind: {
      type: "string",
      const: "binary",
      title: "Kind",
      default: "binary",
    },
    identifier: {
      type: "string",
      title: "Identifier",
      description: `Identifier for the binary content, such as a unique ID.

This identifier can be provided to the model in a message to allow it to refer to this file in a tool call argument,
and the tool can look up the file in question by iterating over the message history and finding the matching \`BinaryContent\`.

This identifier is only automatically passed to the model when the \`BinaryContent\` is returned by a tool.
If you're passing the \`BinaryContent\` as a user message, it's up to you to include a separate text part with the identifier,
e.g. "This is file <identifier>:" preceding the \`BinaryContent\`.

It's also included in inline-text delimiters for providers that require inlining text documents, so the model can
distinguish multiple files.`,
      readOnly: true,
    },
  },
  type: "object",
  required: ["data", "media_type", "identifier"],
  title: "BinaryContent",
  description: "Binary content, e.g. an audio or image file.",
} as const

export const $Body_auth_auth_database_login = {
  properties: {
    grant_type: {
      anyOf: [
        {
          type: "string",
          pattern: "^password$",
        },
        {
          type: "null",
        },
      ],
      title: "Grant Type",
    },
    username: {
      type: "string",
      title: "Username",
    },
    password: {
      type: "string",
      format: "password",
      title: "Password",
    },
    scope: {
      type: "string",
      title: "Scope",
      default: "",
    },
    client_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Client Id",
    },
    client_secret: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      format: "password",
      title: "Client Secret",
    },
  },
  type: "object",
  required: ["username", "password"],
  title: "Body_auth-auth:database.login",
} as const

export const $Body_auth_reset_forgot_password = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
  },
  type: "object",
  required: ["email"],
  title: "Body_auth-reset:forgot_password",
} as const

export const $Body_auth_reset_reset_password = {
  properties: {
    token: {
      type: "string",
      title: "Token",
    },
    password: {
      type: "string",
      title: "Password",
    },
  },
  type: "object",
  required: ["token", "password"],
  title: "Body_auth-reset:reset_password",
} as const

export const $Body_auth_sso_acs = {
  properties: {
    saml_response: {
      type: "string",
      title: "Saml Response",
    },
    relay_state: {
      type: "string",
      title: "Relay State",
    },
  },
  type: "object",
  required: ["saml_response", "relay_state"],
  title: "Body_auth-sso_acs",
} as const

export const $Body_auth_verify_request_token = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
  },
  type: "object",
  required: ["email"],
  title: "Body_auth-verify:request-token",
} as const

export const $Body_auth_verify_verify = {
  properties: {
    token: {
      type: "string",
      title: "Token",
    },
  },
  type: "object",
  required: ["token"],
  title: "Body_auth-verify:verify",
} as const

export const $Body_case_attachments_create_attachment = {
  properties: {
    file: {
      type: "string",
      format: "binary",
      title: "File",
    },
  },
  type: "object",
  required: ["file"],
  title: "Body_case-attachments-create_attachment",
} as const

export const $Body_tables_import_csv = {
  properties: {
    file: {
      type: "string",
      format: "binary",
      title: "File",
    },
    column_mapping: {
      type: "string",
      title: "Column Mapping",
    },
  },
  type: "object",
  required: ["file", "column_mapping"],
  title: "Body_tables-import_csv",
} as const

export const $Body_tables_import_table_from_csv = {
  properties: {
    file: {
      type: "string",
      format: "binary",
      title: "File",
    },
    table_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Table Name",
    },
  },
  type: "object",
  required: ["file"],
  title: "Body_tables-import_table_from_csv",
} as const

export const $Body_workflows_create_workflow = {
  properties: {
    title: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Title",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    use_workflow_id: {
      type: "boolean",
      title: "Use Workflow Id",
      description: "Use the workflow ID if it is provided in the YAML file",
      default: false,
    },
    file: {
      anyOf: [
        {
          type: "string",
          format: "binary",
        },
        {
          type: "null",
        },
      ],
      title: "File",
    },
  },
  type: "object",
  title: "Body_workflows-create_workflow",
} as const

export const $CachePoint = {
  properties: {
    kind: {
      type: "string",
      const: "cache-point",
      title: "Kind",
      default: "cache-point",
    },
    ttl: {
      type: "string",
      enum: ["5m", "1h"],
      title: "Ttl",
      default: "5m",
    },
  },
  type: "object",
  title: "CachePoint",
} as const

export const $CaseAttachmentDownloadResponse = {
  properties: {
    download_url: {
      type: "string",
      title: "Download Url",
      description: "Pre-signed download URL",
    },
    file_name: {
      type: "string",
      title: "File Name",
      description: "Original filename",
    },
    content_type: {
      type: "string",
      title: "Content Type",
      description: "MIME type of the file",
    },
  },
  type: "object",
  required: ["download_url", "file_name", "content_type"],
  title: "CaseAttachmentDownloadResponse",
  description: "Model for attachment download URL response.",
} as const

export const $CaseAttachmentRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    case_id: {
      type: "string",
      format: "uuid",
      title: "Case Id",
    },
    file_id: {
      type: "string",
      format: "uuid",
      title: "File Id",
    },
    file_name: {
      type: "string",
      title: "File Name",
    },
    content_type: {
      type: "string",
      title: "Content Type",
    },
    size: {
      type: "integer",
      title: "Size",
    },
    sha256: {
      type: "string",
      title: "Sha256",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    creator_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Creator Id",
    },
    is_deleted: {
      type: "boolean",
      title: "Is Deleted",
      default: false,
    },
  },
  type: "object",
  required: [
    "id",
    "case_id",
    "file_id",
    "file_name",
    "content_type",
    "size",
    "sha256",
    "created_at",
    "updated_at",
  ],
  title: "CaseAttachmentRead",
  description: "Model for reading a case attachment.",
} as const

export const $CaseCommentCreate = {
  properties: {
    content: {
      type: "string",
      maxLength: 25000,
      minLength: 1,
      title: "Content",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    workflow_id: {
      anyOf: [
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
    },
  },
  type: "object",
  required: ["content"],
  title: "CaseCommentCreate",
} as const

export const $CaseCommentDeleteMode = {
  type: "string",
  enum: ["soft", "hard"],
} as const

export const $CaseCommentRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    content: {
      type: "string",
      title: "Content",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    workflow: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseCommentWorkflowRead",
        },
        {
          type: "null",
        },
      ],
    },
    user: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserRead",
        },
        {
          type: "null",
        },
      ],
    },
    last_edited_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Edited At",
    },
    deleted_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Deleted At",
    },
    is_deleted: {
      type: "boolean",
      title: "Is Deleted",
      default: false,
    },
  },
  type: "object",
  required: ["id", "created_at", "updated_at", "content"],
  title: "CaseCommentRead",
} as const

export const $CaseCommentThreadRead = {
  properties: {
    comment: {
      $ref: "#/components/schemas/CaseCommentRead",
    },
    replies: {
      items: {
        $ref: "#/components/schemas/CaseCommentRead",
      },
      type: "array",
      title: "Replies",
    },
    reply_count: {
      type: "integer",
      title: "Reply Count",
      default: 0,
    },
    last_activity_at: {
      type: "string",
      format: "date-time",
      title: "Last Activity At",
    },
  },
  type: "object",
  required: ["comment", "last_activity_at"],
  title: "CaseCommentThreadRead",
} as const

export const $CaseCommentUpdate = {
  properties: {
    content: {
      anyOf: [
        {
          type: "string",
          maxLength: 25000,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Content",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
  },
  type: "object",
  title: "CaseCommentUpdate",
} as const

export const $CaseCommentWorkflowRead = {
  properties: {
    workflow_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    alias: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Alias",
    },
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
    },
    status: {
      $ref: "#/components/schemas/CaseCommentWorkflowStatus",
    },
  },
  type: "object",
  required: ["title", "status"],
  title: "CaseCommentWorkflowRead",
} as const

export const $CaseCommentWorkflowStatus = {
  type: "string",
  enum: ["running", "succeeded", "failed"],
  title: "CaseCommentWorkflowStatus",
} as const

export const $CaseCreate = {
  properties: {
    summary: {
      type: "string",
      title: "Summary",
    },
    description: {
      type: "string",
      title: "Description",
    },
    status: {
      $ref: "#/components/schemas/CaseStatus",
    },
    priority: {
      $ref: "#/components/schemas/CasePriority",
    },
    severity: {
      $ref: "#/components/schemas/CaseSeverity",
    },
    fields: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Fields",
    },
    dropdown_values: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/CaseDropdownValueInput",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Dropdown Values",
    },
    assignee_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Assignee Id",
    },
    payload: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Payload",
    },
  },
  type: "object",
  required: ["summary", "description", "status", "priority", "severity"],
  title: "CaseCreate",
} as const

export const $CaseDropdownDefinitionCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Name",
    },
    ref: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Ref",
    },
    icon_name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
        },
        {
          type: "null",
        },
      ],
      title: "Icon Name",
    },
    is_ordered: {
      type: "boolean",
      title: "Is Ordered",
      default: false,
    },
    required_on_closure: {
      type: "boolean",
      title: "Required On Closure",
      default: false,
    },
    position: {
      type: "integer",
      title: "Position",
      default: 0,
    },
    options: {
      items: {
        $ref: "#/components/schemas/CaseDropdownOptionCreate",
      },
      type: "array",
      title: "Options",
    },
  },
  type: "object",
  required: ["name", "ref"],
  title: "CaseDropdownDefinitionCreate",
  description: "Create a new dropdown definition with initial options.",
} as const

export const $CaseDropdownDefinitionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    ref: {
      type: "string",
      title: "Ref",
    },
    icon_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Icon Name",
    },
    is_ordered: {
      type: "boolean",
      title: "Is Ordered",
    },
    required_on_closure: {
      type: "boolean",
      title: "Required On Closure",
    },
    position: {
      type: "integer",
      title: "Position",
    },
    options: {
      items: {
        $ref: "#/components/schemas/CaseDropdownOptionRead",
      },
      type: "array",
      title: "Options",
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "ref",
    "is_ordered",
    "required_on_closure",
    "position",
  ],
  title: "CaseDropdownDefinitionRead",
  description: "Read model for a dropdown definition with its options.",
} as const

export const $CaseDropdownDefinitionUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    ref: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
    },
    icon_name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
        },
        {
          type: "null",
        },
      ],
      title: "Icon Name",
    },
    is_ordered: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Ordered",
    },
    required_on_closure: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Required On Closure",
    },
    position: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Position",
    },
  },
  type: "object",
  title: "CaseDropdownDefinitionUpdate",
  description: "Update an existing dropdown definition.",
} as const

export const $CaseDropdownOptionCreate = {
  properties: {
    label: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Label",
    },
    ref: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Ref",
    },
    icon_name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
        },
        {
          type: "null",
        },
      ],
      title: "Icon Name",
    },
    color: {
      anyOf: [
        {
          type: "string",
          maxLength: 50,
        },
        {
          type: "null",
        },
      ],
      title: "Color",
    },
    position: {
      type: "integer",
      title: "Position",
      default: 0,
    },
  },
  type: "object",
  required: ["label", "ref"],
  title: "CaseDropdownOptionCreate",
  description: "Create a new option within a dropdown definition.",
} as const

export const $CaseDropdownOptionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    label: {
      type: "string",
      title: "Label",
    },
    ref: {
      type: "string",
      title: "Ref",
    },
    icon_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Icon Name",
    },
    color: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Color",
    },
    position: {
      type: "integer",
      title: "Position",
    },
  },
  type: "object",
  required: ["id", "label", "ref", "position"],
  title: "CaseDropdownOptionRead",
  description: "Read model for a dropdown option.",
} as const

export const $CaseDropdownOptionUpdate = {
  properties: {
    label: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Label",
    },
    ref: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
    },
    icon_name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
        },
        {
          type: "null",
        },
      ],
      title: "Icon Name",
    },
    color: {
      anyOf: [
        {
          type: "string",
          maxLength: 50,
        },
        {
          type: "null",
        },
      ],
      title: "Color",
    },
    position: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Position",
    },
  },
  type: "object",
  title: "CaseDropdownOptionUpdate",
  description: "Update an existing dropdown option.",
} as const

export const $CaseDropdownValueInput = {
  properties: {
    definition_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Definition Id",
      description: "Dropdown definition ID.",
    },
    definition_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Definition Ref",
      description: "Dropdown definition ref.",
    },
    option_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Option Id",
      description: "Dropdown option ID. Pass null to clear the value.",
    },
    option_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Option Ref",
      description: "Dropdown option ref. Pass null to clear the value.",
    },
  },
  type: "object",
  title: "CaseDropdownValueInput",
  description: "Dropdown selection payload for case create/update operations.",
} as const

export const $CaseDropdownValueRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    definition_id: {
      type: "string",
      format: "uuid",
      title: "Definition Id",
    },
    definition_ref: {
      type: "string",
      title: "Definition Ref",
    },
    definition_name: {
      type: "string",
      title: "Definition Name",
    },
    option_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Option Id",
    },
    option_label: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Option Label",
    },
    option_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Option Ref",
    },
    option_icon_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Option Icon Name",
    },
    option_color: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Option Color",
    },
  },
  type: "object",
  required: ["id", "definition_id", "definition_ref", "definition_name"],
  title: "CaseDropdownValueRead",
  description: "Per-case dropdown value with full definition/option info.",
} as const

export const $CaseDropdownValueSet = {
  properties: {
    option_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Option Id",
      description: "The option ID to set. Pass null to clear the value.",
    },
  },
  type: "object",
  title: "CaseDropdownValueSet",
  description:
    "Request body for setting or clearing a dropdown value on a case.",
} as const

export const $CaseDurationAnchorSelection = {
  type: "string",
  enum: ["first", "last"],
  title: "CaseDurationAnchorSelection",
  description:
    "Strategies for choosing which matching event should anchor a duration.",
} as const

export const $CaseDurationCreate = {
  properties: {
    definition_id: {
      type: "string",
      format: "uuid",
      title: "Definition Id",
      description:
        "Identifier of the case duration definition generating this duration.",
    },
    start_event_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Start Event Id",
      description: "Case event that started the duration, if available.",
    },
    end_event_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "End Event Id",
      description: "Case event that ended the duration, if available.",
    },
    started_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Started At",
      description: "Timestamp when the duration began.",
    },
    ended_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Ended At",
      description: "Timestamp when the duration ended.",
    },
    duration: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Duration",
      description: "Total elapsed time between start and end timestamps.",
    },
  },
  type: "object",
  required: ["definition_id"],
  title: "CaseDurationCreate",
  description: "Create payload for case duration records.",
} as const

export const $CaseDurationDefinitionCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      title: "Name",
      description: "Human readable name for the metric.",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1024,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description providing more context.",
    },
    start_anchor: {
      $ref: "#/components/schemas/CaseDurationEventAnchor",
      description: "Event configuration that marks the start of the duration.",
    },
    end_anchor: {
      $ref: "#/components/schemas/CaseDurationEventAnchor",
      description: "Event configuration that marks the end of the duration.",
    },
  },
  type: "object",
  required: ["name", "start_anchor", "end_anchor"],
  title: "CaseDurationDefinitionCreate",
  description: "Create payload for case duration definitions.",
} as const

export const $CaseDurationDefinitionRead = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      title: "Name",
      description: "Human readable name for the metric.",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1024,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description providing more context.",
    },
    start_anchor: {
      $ref: "#/components/schemas/CaseDurationEventAnchor",
      description: "Event configuration that marks the start of the duration.",
    },
    end_anchor: {
      $ref: "#/components/schemas/CaseDurationEventAnchor",
      description: "Event configuration that marks the end of the duration.",
    },
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
  },
  type: "object",
  required: ["name", "start_anchor", "end_anchor", "id"],
  title: "CaseDurationDefinitionRead",
  description: "Read model for case duration definitions.",
} as const

export const $CaseDurationDefinitionUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1024,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    start_anchor: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseDurationEventAnchor",
        },
        {
          type: "null",
        },
      ],
    },
    end_anchor: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseDurationEventAnchor",
        },
        {
          type: "null",
        },
      ],
    },
  },
  type: "object",
  title: "CaseDurationDefinitionUpdate",
  description: "Patch payload for case duration definitions.",
} as const

export const $CaseDurationEventAnchor = {
  properties: {
    event_type: {
      $ref: "#/components/schemas/CaseEventType",
      description: "Case event type that should be matched for this anchor.",
    },
    filters: {
      $ref: "#/components/schemas/CaseDurationEventFilters",
      description:
        "Optional product-level filters for matching event payload values.",
    },
    selection: {
      $ref: "#/components/schemas/CaseDurationAnchorSelection",
      description:
        "Whether to use the first or last matching event for this anchor. Defaults to the first match.",
      default: "first",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["event_type"],
  title: "CaseDurationEventAnchor",
  description:
    "Selection criteria describing an event boundary for a duration.",
} as const

export const $CaseDurationEventFilters = {
  properties: {
    new_values: {
      items: {
        type: "string",
      },
      type: "array",
      title: "New Values",
      description: "New priority, severity, or status values to match.",
    },
    tag_refs: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Tag Refs",
      description: "Case tag refs to match for tag add/remove events.",
    },
    field_ids: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Field Ids",
      description: "Case custom field IDs to match for field change events.",
    },
    dropdown_definition_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Dropdown Definition Id",
      description:
        "Dropdown definition ID to match for dropdown value change events.",
    },
    dropdown_option_ids: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Dropdown Option Ids",
      description:
        "Dropdown option IDs to match for dropdown value change events.",
    },
  },
  additionalProperties: false,
  type: "object",
  title: "CaseDurationEventFilters",
  description:
    "Product-level filters for narrowing case duration event anchors.",
} as const

export const $CaseDurationRead = {
  properties: {
    definition_id: {
      type: "string",
      format: "uuid",
      title: "Definition Id",
      description:
        "Identifier of the case duration definition generating this duration.",
    },
    start_event_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Start Event Id",
      description: "Case event that started the duration, if available.",
    },
    end_event_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "End Event Id",
      description: "Case event that ended the duration, if available.",
    },
    started_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Started At",
      description: "Timestamp when the duration began.",
    },
    ended_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Ended At",
      description: "Timestamp when the duration ended.",
    },
    duration: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Duration",
      description: "Total elapsed time between start and end timestamps.",
    },
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    case_id: {
      type: "string",
      format: "uuid",
      title: "Case Id",
    },
  },
  type: "object",
  required: ["definition_id", "id", "case_id"],
  title: "CaseDurationRead",
  description: "Read model for case duration records.",
} as const

export const $CaseDurationUpdate = {
  properties: {
    definition_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Definition Id",
    },
    start_event_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Start Event Id",
    },
    end_event_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "End Event Id",
    },
    started_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Started At",
    },
    ended_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Ended At",
    },
    duration: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Duration",
    },
  },
  type: "object",
  title: "CaseDurationUpdate",
  description: "Patch payload for case duration records.",
} as const

export const $CaseEventRead = {
  oneOf: [
    {
      $ref: "#/components/schemas/CreatedEventRead",
    },
    {
      $ref: "#/components/schemas/ClosedEventRead",
    },
    {
      $ref: "#/components/schemas/ReopenedEventRead",
    },
    {
      $ref: "#/components/schemas/CaseViewedEventRead",
    },
    {
      $ref: "#/components/schemas/UpdatedEventRead",
    },
    {
      $ref: "#/components/schemas/StatusChangedEventRead",
    },
    {
      $ref: "#/components/schemas/PriorityChangedEventRead",
    },
    {
      $ref: "#/components/schemas/SeverityChangedEventRead",
    },
    {
      $ref: "#/components/schemas/FieldChangedEventRead",
    },
    {
      $ref: "#/components/schemas/AssigneeChangedEventRead",
    },
    {
      $ref: "#/components/schemas/AttachmentCreatedEventRead",
    },
    {
      $ref: "#/components/schemas/AttachmentDeletedEventRead",
    },
    {
      $ref: "#/components/schemas/TagAddedEventRead",
    },
    {
      $ref: "#/components/schemas/TagRemovedEventRead",
    },
    {
      $ref: "#/components/schemas/PayloadChangedEventRead",
    },
    {
      $ref: "#/components/schemas/CommentCreatedEventRead",
    },
    {
      $ref: "#/components/schemas/CommentUpdatedEventRead",
    },
    {
      $ref: "#/components/schemas/CommentDeletedEventRead",
    },
    {
      $ref: "#/components/schemas/CommentReplyCreatedEventRead",
    },
    {
      $ref: "#/components/schemas/CommentReplyUpdatedEventRead",
    },
    {
      $ref: "#/components/schemas/CommentReplyDeletedEventRead",
    },
    {
      $ref: "#/components/schemas/TaskCreatedEventRead",
    },
    {
      $ref: "#/components/schemas/TaskStatusChangedEventRead",
    },
    {
      $ref: "#/components/schemas/TaskPriorityChangedEventRead",
    },
    {
      $ref: "#/components/schemas/TaskWorkflowChangedEventRead",
    },
    {
      $ref: "#/components/schemas/TaskDeletedEventRead",
    },
    {
      $ref: "#/components/schemas/TaskAssigneeChangedEventRead",
    },
    {
      $ref: "#/components/schemas/DropdownValueChangedEventRead",
    },
    {
      $ref: "#/components/schemas/TableRowLinkedEventRead",
    },
    {
      $ref: "#/components/schemas/TableRowUnlinkedEventRead",
    },
  ],
  title: "CaseEventRead",
  description: "Base read model for all event types.",
  discriminator: {
    propertyName: "type",
    mapping: {
      assignee_changed: "#/components/schemas/AssigneeChangedEventRead",
      attachment_created: "#/components/schemas/AttachmentCreatedEventRead",
      attachment_deleted: "#/components/schemas/AttachmentDeletedEventRead",
      case_closed: "#/components/schemas/ClosedEventRead",
      case_created: "#/components/schemas/CreatedEventRead",
      case_reopened: "#/components/schemas/ReopenedEventRead",
      case_updated: "#/components/schemas/UpdatedEventRead",
      case_viewed: "#/components/schemas/CaseViewedEventRead",
      comment_created: "#/components/schemas/CommentCreatedEventRead",
      comment_deleted: "#/components/schemas/CommentDeletedEventRead",
      comment_reply_created:
        "#/components/schemas/CommentReplyCreatedEventRead",
      comment_reply_deleted:
        "#/components/schemas/CommentReplyDeletedEventRead",
      comment_reply_updated:
        "#/components/schemas/CommentReplyUpdatedEventRead",
      comment_updated: "#/components/schemas/CommentUpdatedEventRead",
      dropdown_value_changed:
        "#/components/schemas/DropdownValueChangedEventRead",
      fields_changed: "#/components/schemas/FieldChangedEventRead",
      payload_changed: "#/components/schemas/PayloadChangedEventRead",
      priority_changed: "#/components/schemas/PriorityChangedEventRead",
      severity_changed: "#/components/schemas/SeverityChangedEventRead",
      status_changed: "#/components/schemas/StatusChangedEventRead",
      table_row_linked: "#/components/schemas/TableRowLinkedEventRead",
      table_row_unlinked: "#/components/schemas/TableRowUnlinkedEventRead",
      tag_added: "#/components/schemas/TagAddedEventRead",
      tag_removed: "#/components/schemas/TagRemovedEventRead",
      task_assignee_changed:
        "#/components/schemas/TaskAssigneeChangedEventRead",
      task_created: "#/components/schemas/TaskCreatedEventRead",
      task_deleted: "#/components/schemas/TaskDeletedEventRead",
      task_priority_changed:
        "#/components/schemas/TaskPriorityChangedEventRead",
      task_status_changed: "#/components/schemas/TaskStatusChangedEventRead",
      task_workflow_changed:
        "#/components/schemas/TaskWorkflowChangedEventRead",
    },
  },
} as const

export const $CaseEventType = {
  type: "string",
  enum: [
    "case_created",
    "case_updated",
    "case_closed",
    "case_reopened",
    "case_viewed",
    "priority_changed",
    "severity_changed",
    "status_changed",
    "fields_changed",
    "assignee_changed",
    "attachment_created",
    "attachment_deleted",
    "tag_added",
    "tag_removed",
    "payload_changed",
    "task_created",
    "task_deleted",
    "task_status_changed",
    "task_priority_changed",
    "task_workflow_changed",
    "task_assignee_changed",
    "dropdown_value_changed",
    "table_row_linked",
    "table_row_unlinked",
    "comment_created",
    "comment_updated",
    "comment_deleted",
    "comment_reply_created",
    "comment_reply_updated",
    "comment_reply_deleted",
  ],
  title: "CaseEventType",
  description: "Case activity type values.",
} as const

export const $CaseEventsWithUsers = {
  properties: {
    events: {
      items: {
        $ref: "#/components/schemas/CaseEventRead",
      },
      type: "array",
      title: "Events",
      description: "The events for the case.",
    },
    users: {
      items: {
        $ref: "#/components/schemas/UserRead",
      },
      type: "array",
      title: "Users",
      description: "The users for the case.",
    },
  },
  type: "object",
  required: ["events", "users"],
  title: "CaseEventsWithUsers",
} as const

export const $CaseFieldCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Name",
      description: "The name of the column",
    },
    type: {
      $ref: "#/components/schemas/SqlType",
      maxLength: 100,
      minLength: 1,
      description: "The SQL type of the column",
    },
    nullable: {
      type: "boolean",
      title: "Nullable",
      default: true,
    },
    default: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Default",
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
    kind: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseFieldKind",
        },
        {
          type: "null",
        },
      ],
    },
    required_on_closure: {
      type: "boolean",
      title: "Required On Closure",
      default: false,
    },
  },
  type: "object",
  required: ["name", "type"],
  title: "CaseFieldCreate",
  description: "Create a new case field.",
} as const

export const $CaseFieldKind = {
  type: "string",
  enum: ["LONG_TEXT", "URL"],
  title: "CaseFieldKind",
  description: `Semantic kind for case custom fields.

Controls how the field is rendered in the UI without changing the underlying
SQL storage type.`,
} as const

export const $CaseFieldRead = {
  properties: {
    id: {
      type: "string",
      title: "Id",
    },
    type: {
      $ref: "#/components/schemas/CaseFieldReadType",
    },
    description: {
      type: "string",
      title: "Description",
    },
    nullable: {
      type: "boolean",
      title: "Nullable",
    },
    default: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Default",
    },
    reserved: {
      type: "boolean",
      title: "Reserved",
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
    kind: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseFieldKind",
        },
        {
          type: "null",
        },
      ],
    },
    required_on_closure: {
      type: "boolean",
      title: "Required On Closure",
      default: false,
    },
    value: {
      title: "Value",
    },
  },
  type: "object",
  required: [
    "id",
    "type",
    "description",
    "nullable",
    "default",
    "reserved",
    "value",
  ],
  title: "CaseFieldRead",
  description: "Read model for a case field.",
} as const

export const $CaseFieldReadMinimal = {
  properties: {
    id: {
      type: "string",
      title: "Id",
    },
    type: {
      $ref: "#/components/schemas/CaseFieldReadType",
    },
    description: {
      type: "string",
      title: "Description",
    },
    nullable: {
      type: "boolean",
      title: "Nullable",
    },
    default: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Default",
    },
    reserved: {
      type: "boolean",
      title: "Reserved",
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
    kind: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseFieldKind",
        },
        {
          type: "null",
        },
      ],
    },
    required_on_closure: {
      type: "boolean",
      title: "Required On Closure",
      default: false,
    },
  },
  type: "object",
  required: ["id", "type", "description", "nullable", "default", "reserved"],
  title: "CaseFieldReadMinimal",
  description: "Minimal read model for a case field.",
} as const

export const $CaseFieldReadType = {
  type: "string",
  enum: [
    "TEXT",
    "INTEGER",
    "NUMERIC",
    "DATE",
    "BOOLEAN",
    "TIMESTAMPTZ",
    "JSONB",
    "SELECT",
    "MULTI_SELECT",
    "UUID",
  ],
  title: "CaseFieldReadType",
  description: "Read-only type for case field metadata.",
} as const

export const $CaseFieldUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
      description: "The name of the column",
    },
    type: {
      anyOf: [
        {
          $ref: "#/components/schemas/SqlType",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      description: "The SQL type of the column",
    },
    nullable: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Nullable",
      description: "Whether the column can be null",
    },
    default: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Default",
      description: "The default value of the column",
    },
    is_index: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Index",
      description:
        "True creates a unique index, False drops it, None leaves unchanged.",
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
    required_on_closure: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Required On Closure",
    },
  },
  type: "object",
  title: "CaseFieldUpdate",
  description: "Update a case field.",
} as const

export const $CasePriority = {
  type: "string",
  enum: ["unknown", "low", "medium", "high", "critical", "other"],
  title: "CasePriority",
  description: `Case priority values aligned with urgency levels.

Values:
    UNKNOWN (0): No priority is assigned
    LOW (1): Application or personal procedure is unusable, where a workaround is available or a repair is possible
    MEDIUM (2): Non-critical function or procedure is unusable or hard to use causing operational disruptions with no direct impact on a service's availability. A workaround is available
    HIGH (3): Critical functionality or network access is interrupted, degraded or unusable, having a severe impact on services availability. No acceptable alternative is possible
    CRITICAL (4): Interruption making a critical functionality inaccessible or a complete network interruption causing a severe impact on services availability. There is no possible alternative
    OTHER (99): The priority is not normalized`,
} as const

export const $CaseRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    short_id: {
      type: "string",
      title: "Short Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    summary: {
      type: "string",
      title: "Summary",
    },
    status: {
      $ref: "#/components/schemas/CaseStatus",
    },
    priority: {
      $ref: "#/components/schemas/CasePriority",
    },
    severity: {
      $ref: "#/components/schemas/CaseSeverity",
    },
    description: {
      type: "string",
      title: "Description",
    },
    fields: {
      items: {
        $ref: "#/components/schemas/CaseFieldRead",
      },
      type: "array",
      title: "Fields",
    },
    assignee: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserRead",
        },
        {
          type: "null",
        },
      ],
    },
    payload: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Payload",
    },
    tags: {
      items: {
        $ref: "#/components/schemas/CaseTagRead",
      },
      type: "array",
      title: "Tags",
    },
    dropdown_values: {
      items: {
        $ref: "#/components/schemas/CaseDropdownValueRead",
      },
      type: "array",
      title: "Dropdown Values",
    },
    rows: {
      items: {
        $ref: "#/components/schemas/CaseTableRowRead",
      },
      type: "array",
      title: "Rows",
    },
  },
  type: "object",
  required: [
    "id",
    "short_id",
    "created_at",
    "updated_at",
    "summary",
    "status",
    "priority",
    "severity",
    "description",
    "fields",
    "payload",
    "dropdown_values",
  ],
  title: "CaseRead",
} as const

export const $CaseReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    short_id: {
      type: "string",
      title: "Short Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    summary: {
      type: "string",
      title: "Summary",
    },
    status: {
      $ref: "#/components/schemas/CaseStatus",
    },
    priority: {
      $ref: "#/components/schemas/CasePriority",
    },
    severity: {
      $ref: "#/components/schemas/CaseSeverity",
    },
    assignee: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserRead",
        },
        {
          type: "null",
        },
      ],
    },
    tags: {
      items: {
        $ref: "#/components/schemas/CaseTagRead",
      },
      type: "array",
      title: "Tags",
    },
    dropdown_values: {
      items: {
        $ref: "#/components/schemas/CaseDropdownValueRead",
      },
      type: "array",
      title: "Dropdown Values",
    },
    rows: {
      items: {
        $ref: "#/components/schemas/CaseTableRowRead",
      },
      type: "array",
      title: "Rows",
    },
    durations: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/CaseDurationRead",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Durations",
    },
    field_values: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Field Values",
    },
    num_tasks_completed: {
      type: "integer",
      title: "Num Tasks Completed",
      default: 0,
    },
    num_tasks_total: {
      type: "integer",
      title: "Num Tasks Total",
      default: 0,
    },
  },
  type: "object",
  required: [
    "id",
    "short_id",
    "created_at",
    "updated_at",
    "summary",
    "status",
    "priority",
    "severity",
    "dropdown_values",
  ],
  title: "CaseReadMinimal",
} as const

export const $CaseSearchAggregateRead = {
  properties: {
    total: {
      type: "integer",
      title: "Total",
    },
    status_groups: {
      $ref: "#/components/schemas/CaseStatusGroupCounts",
    },
  },
  type: "object",
  required: ["total", "status_groups"],
  title: "CaseSearchAggregateRead",
} as const

export const $CaseSeverity = {
  type: "string",
  enum: [
    "unknown",
    "informational",
    "low",
    "medium",
    "high",
    "critical",
    "fatal",
    "other",
  ],
  title: "CaseSeverity",
  description: `Case severity values aligned with OCSF severity values.

Values:
    UNKNOWN (0): The event/finding severity is unknown
    INFORMATIONAL (1): Informational message. No action required
    LOW (2): The user decides if action is needed
    MEDIUM (3): Action is required but the situation is not serious at this time
    HIGH (4): Action is required immediately
    CRITICAL (5): Action is required immediately and the scope is broad
    FATAL (6): An error occurred but it is too late to take remedial action
    OTHER (99): The event/finding severity is not mapped`,
} as const

export const $CaseStatus = {
  type: "string",
  enum: [
    "unknown",
    "new",
    "in_progress",
    "on_hold",
    "resolved",
    "closed",
    "other",
  ],
  title: "CaseStatus",
  description: "Case status values aligned with OCSF Incident Finding status.",
} as const

export const $CaseStatusGroupCounts = {
  properties: {
    new: {
      type: "integer",
      title: "New",
      default: 0,
    },
    in_progress: {
      type: "integer",
      title: "In Progress",
      default: 0,
    },
    on_hold: {
      type: "integer",
      title: "On Hold",
      default: 0,
    },
    resolved: {
      type: "integer",
      title: "Resolved",
      default: 0,
    },
    closed: {
      type: "integer",
      title: "Closed",
      default: 0,
    },
    unknown: {
      type: "integer",
      title: "Unknown",
      default: 0,
    },
    other: {
      type: "integer",
      title: "Other",
      default: 0,
    },
  },
  type: "object",
  title: "CaseStatusGroupCounts",
} as const

export const $CaseTableRowInsertCreate = {
  properties: {
    table_id: {
      type: "string",
      format: "uuid",
      title: "Table Id",
    },
    row: {
      $ref: "#/components/schemas/TableRowInsert",
    },
  },
  type: "object",
  required: ["table_id", "row"],
  title: "CaseTableRowInsertCreate",
} as const

export const $CaseTableRowLinkCreate = {
  properties: {
    table_id: {
      type: "string",
      format: "uuid",
      title: "Table Id",
    },
    row_id: {
      type: "string",
      format: "uuid",
      title: "Row Id",
    },
  },
  type: "object",
  required: ["table_id", "row_id"],
  title: "CaseTableRowLinkCreate",
} as const

export const $CaseTableRowRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    case_id: {
      type: "string",
      format: "uuid",
      title: "Case Id",
    },
    table_id: {
      type: "string",
      format: "uuid",
      title: "Table Id",
    },
    table_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Table Name",
    },
    row_id: {
      type: "string",
      format: "uuid",
      title: "Row Id",
    },
    row_data: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Row Data",
    },
    is_row_available: {
      type: "boolean",
      title: "Is Row Available",
      default: true,
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: ["id", "case_id", "table_id", "row_id", "created_at", "updated_at"],
  title: "CaseTableRowRead",
} as const

export const $CaseTagCreate = {
  properties: {
    tag_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "string",
        },
      ],
      maxLength: 100,
      minLength: 1,
      title: "Tag Id",
      description: "Tag ID (UUID) or ref",
    },
  },
  type: "object",
  required: ["tag_id"],
  title: "CaseTagCreate",
} as const

export const $CaseTagRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    ref: {
      type: "string",
      title: "Ref",
    },
    color: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Color",
    },
  },
  type: "object",
  required: ["id", "name", "ref", "color"],
  title: "CaseTagRead",
  description: "Tag data.",
} as const

export const $CaseTaskCreate = {
  properties: {
    title: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Title",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    priority: {
      $ref: "#/components/schemas/CasePriority",
      default: "unknown",
    },
    status: {
      $ref: "#/components/schemas/CaseTaskStatus",
      default: "todo",
    },
    assignee_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Assignee Id",
    },
    workflow_id: {
      anyOf: [
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
    },
    default_trigger_values: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Default Trigger Values",
    },
  },
  type: "object",
  required: ["title"],
  title: "CaseTaskCreate",
} as const

export const $CaseTaskRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    case_id: {
      type: "string",
      format: "uuid",
      title: "Case Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    priority: {
      $ref: "#/components/schemas/CasePriority",
    },
    status: {
      $ref: "#/components/schemas/CaseTaskStatus",
    },
    assignee: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserRead",
        },
        {
          type: "null",
        },
      ],
    },
    workflow_id: {
      anyOf: [
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
    },
    default_trigger_values: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Default Trigger Values",
    },
  },
  type: "object",
  required: [
    "id",
    "created_at",
    "updated_at",
    "case_id",
    "title",
    "description",
    "priority",
    "status",
    "workflow_id",
  ],
  title: "CaseTaskRead",
} as const

export const $CaseTaskStatus = {
  type: "string",
  enum: ["todo", "in_progress", "completed", "blocked"],
  title: "CaseTaskStatus",
  description: "Case task status values.",
} as const

export const $CaseTaskUpdate = {
  properties: {
    title: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Title",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    priority: {
      anyOf: [
        {
          $ref: "#/components/schemas/CasePriority",
        },
        {
          type: "null",
        },
      ],
    },
    status: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseTaskStatus",
        },
        {
          type: "null",
        },
      ],
    },
    assignee_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Assignee Id",
    },
    workflow_id: {
      anyOf: [
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
    },
    default_trigger_values: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Default Trigger Values",
    },
  },
  type: "object",
  title: "CaseTaskUpdate",
} as const

export const $CaseTriggerCreate = {
  properties: {
    status: {
      type: "string",
      enum: ["online", "offline"],
      title: "Status",
      default: "offline",
    },
    event_types: {
      items: {
        $ref: "#/components/schemas/CaseEventType",
      },
      type: "array",
      title: "Event Types",
    },
    tag_filters: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Tag Filters",
    },
  },
  type: "object",
  title: "CaseTriggerCreate",
} as const

export const $CaseTriggerRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workflow_id: {
      type: "string",
      title: "Workflow Id",
    },
    status: {
      type: "string",
      enum: ["online", "offline"],
      title: "Status",
    },
    event_types: {
      items: {
        $ref: "#/components/schemas/CaseEventType",
      },
      type: "array",
      title: "Event Types",
    },
    tag_filters: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Tag Filters",
    },
  },
  type: "object",
  required: ["id", "workflow_id", "status", "event_types", "tag_filters"],
  title: "CaseTriggerRead",
} as const

export const $CaseTriggerUpdate = {
  properties: {
    status: {
      anyOf: [
        {
          type: "string",
          enum: ["online", "offline"],
        },
        {
          type: "null",
        },
      ],
      title: "Status",
    },
    event_types: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/CaseEventType",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Event Types",
    },
    tag_filters: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Tag Filters",
    },
  },
  type: "object",
  title: "CaseTriggerUpdate",
} as const

export const $CaseUpdate = {
  properties: {
    summary: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Summary",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    status: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseStatus",
        },
        {
          type: "null",
        },
      ],
    },
    priority: {
      anyOf: [
        {
          $ref: "#/components/schemas/CasePriority",
        },
        {
          type: "null",
        },
      ],
    },
    severity: {
      anyOf: [
        {
          $ref: "#/components/schemas/CaseSeverity",
        },
        {
          type: "null",
        },
      ],
    },
    fields: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Fields",
    },
    dropdown_values: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/CaseDropdownValueInput",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Dropdown Values",
    },
    assignee_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Assignee Id",
    },
    payload: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Payload",
    },
  },
  type: "object",
  title: "CaseUpdate",
} as const

export const $CaseViewedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "case_viewed",
      title: "Type",
      default: "case_viewed",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["created_at"],
  title: "CaseViewedEventRead",
  description: "Event for when a case is viewed.",
} as const

export const $ChannelType = {
  type: "string",
  enum: ["slack"],
  title: "ChannelType",
  description: "Supported external channel types.",
} as const

export const $ChatMessage = {
  properties: {
    id: {
      type: "string",
      title: "Id",
      description: "Unique message identifier",
    },
    kind: {
      $ref: "#/components/schemas/MessageKind",
      description: "Message kind for rendering",
      default: "chat-message",
    },
    message: {
      anyOf: [
        {},
        {
          $ref: "#/components/schemas/UserMessage",
        },
        {
          $ref: "#/components/schemas/AssistantMessage",
        },
        {
          $ref: "#/components/schemas/SystemMessage",
        },
        {
          $ref: "#/components/schemas/ResultMessage",
        },
        {
          $ref: "#/components/schemas/StreamEvent",
        },
        {
          $ref: "#/components/schemas/RateLimitEvent",
        },
        {
          type: "null",
        },
      ],
      title: "Message",
      description: "The deserialized message (for kind=CHAT_MESSAGE)",
    },
    approval: {
      anyOf: [
        {
          $ref: "#/components/schemas/ApprovalRead",
        },
        {
          type: "null",
        },
      ],
      description:
        "Approval data for approval bubble rendering (for kind=APPROVAL_REQUEST/APPROVAL_DECISION)",
    },
    compaction: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Compaction",
      description:
        "Compaction status data for badge rendering (for kind=COMPACTION)",
    },
  },
  type: "object",
  required: ["id"],
  title: "ChatMessage",
  description: `Model for a chat message with typed message payload.

This model supports multiple message kinds:
- kind=CHAT_MESSAGE: Contains message field with user/assistant content
- kind=APPROVAL_REQUEST/APPROVAL_DECISION: Contains approval field with approval data
- kind=COMPACTION: Contains compaction field with compaction status data`,
} as const

export const $ChatRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
      description: "Unique chat identifier",
    },
    title: {
      type: "string",
      title: "Title",
      description: "Human-readable title for the chat",
    },
    user_id: {
      type: "string",
      format: "uuid4",
      title: "User Id",
      description: "ID of the user who owns the chat",
    },
    entity_type: {
      type: "string",
      title: "Entity Type",
      description: "Type of entity this chat is associated with",
    },
    entity_id: {
      type: "string",
      format: "uuid4",
      title: "Entity Id",
      description: "ID of the associated entity",
    },
    tools: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Tools",
      description: "Tools available to the agent",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
      description: "Agent preset used for this chat, if any",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
      description: "Pinned preset version used for this chat, if any",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "When the chat was created",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
      description: "When the chat was last updated",
    },
    last_stream_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Stream Id",
      description: "Last processed Redis stream ID for this chat",
    },
    is_readonly: {
      type: "boolean",
      title: "Is Readonly",
      description:
        "Whether this chat is read-only (legacy chats cannot be modified)",
      default: true,
    },
    messages: {
      items: {
        $ref: "#/components/schemas/ChatMessage",
      },
      type: "array",
      title: "Messages",
      description: "Chat messages from Redis stream",
    },
  },
  type: "object",
  required: [
    "id",
    "title",
    "user_id",
    "entity_type",
    "entity_id",
    "tools",
    "created_at",
    "updated_at",
  ],
  title: "ChatRead",
  description: "Model for chat metadata with message history.",
} as const

export const $ChatReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
      description: "Unique chat identifier",
    },
    title: {
      type: "string",
      title: "Title",
      description: "Human-readable title for the chat",
    },
    user_id: {
      type: "string",
      format: "uuid4",
      title: "User Id",
      description: "ID of the user who owns the chat",
    },
    entity_type: {
      type: "string",
      title: "Entity Type",
      description: "Type of entity this chat is associated with",
    },
    entity_id: {
      type: "string",
      format: "uuid4",
      title: "Entity Id",
      description: "ID of the associated entity",
    },
    tools: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Tools",
      description: "Tools available to the agent",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
      description: "Agent preset used for this chat, if any",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
      description: "Pinned preset version used for this chat, if any",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "When the chat was created",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
      description: "When the chat was last updated",
    },
    last_stream_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Stream Id",
      description: "Last processed Redis stream ID for this chat",
    },
    is_readonly: {
      type: "boolean",
      title: "Is Readonly",
      description:
        "Whether this chat is read-only (legacy chats cannot be modified)",
      default: true,
    },
  },
  type: "object",
  required: [
    "id",
    "title",
    "user_id",
    "entity_type",
    "entity_id",
    "tools",
    "created_at",
    "updated_at",
  ],
  title: "ChatReadMinimal",
  description: `Model for chat metadata without messages.

Note: Legacy Chat records are read-only (is_readonly=True).`,
} as const

export const $ChatReadVercel = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
      description: "Unique chat identifier",
    },
    title: {
      type: "string",
      title: "Title",
      description: "Human-readable title for the chat",
    },
    user_id: {
      type: "string",
      format: "uuid4",
      title: "User Id",
      description: "ID of the user who owns the chat",
    },
    entity_type: {
      type: "string",
      title: "Entity Type",
      description: "Type of entity this chat is associated with",
    },
    entity_id: {
      type: "string",
      format: "uuid4",
      title: "Entity Id",
      description: "ID of the associated entity",
    },
    tools: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Tools",
      description: "Tools available to the agent",
    },
    agent_preset_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Id",
      description: "Agent preset used for this chat, if any",
    },
    agent_preset_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Preset Version Id",
      description: "Pinned preset version used for this chat, if any",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "When the chat was created",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
      description: "When the chat was last updated",
    },
    last_stream_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Stream Id",
      description: "Last processed Redis stream ID for this chat",
    },
    is_readonly: {
      type: "boolean",
      title: "Is Readonly",
      description:
        "Whether this chat is read-only (legacy chats cannot be modified)",
      default: true,
    },
    messages: {
      items: {
        $ref: "#/components/schemas/UIMessage",
      },
      type: "array",
      title: "Messages",
      description: "Chat messages from Redis stream",
    },
  },
  type: "object",
  required: [
    "id",
    "title",
    "user_id",
    "entity_type",
    "entity_id",
    "tools",
    "created_at",
    "updated_at",
  ],
  title: "ChatReadVercel",
  description: "Model for chat metadata with message history in Vercel format.",
} as const

export const $ClosedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "case_closed",
      title: "Type",
      default: "case_closed",
    },
    old: {
      $ref: "#/components/schemas/CaseStatus",
    },
    new: {
      $ref: "#/components/schemas/CaseStatus",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["old", "new", "created_at"],
  title: "ClosedEventRead",
  description: "Event for when a case is closed.",
} as const

export const $Code = {
  properties: {
    component_id: {
      type: "string",
      const: "code",
      title: "Component Id",
      default: "code",
    },
    lang: {
      type: "string",
      enum: ["yaml", "python"],
      title: "Lang",
      default: "python",
    },
  },
  type: "object",
  title: "Code",
} as const

export const $CollectionObject = {
  properties: {
    typename: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Typename",
    },
    type: {
      type: "string",
      const: "collection",
      title: "Type",
    },
    manifest_ref: {
      $ref: "#/components/schemas/ObjectRef",
    },
    count: {
      type: "integer",
      title: "Count",
    },
    chunk_size: {
      type: "integer",
      title: "Chunk Size",
    },
    element_kind: {
      type: "string",
      enum: ["value", "stored_object"],
      title: "Element Kind",
    },
    schema_version: {
      type: "integer",
      title: "Schema Version",
      default: 1,
    },
    index: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Index",
    },
  },
  type: "object",
  required: ["type", "manifest_ref", "count", "chunk_size", "element_kind"],
  title: "CollectionObject",
  description: `Handle to a collection manifest stored in blob storage.

Represents huge collections without embedding list[StoredObject] in history.
The manifest contains chunk references for paged access.

This is a small, history-safe handle. The actual data lives in chunked
blobs referenced by the manifest.

Attributes:
    manifest_ref: Reference to the manifest blob containing chunk refs.
    count: Total number of elements in the collection.
    chunk_size: Number of items per chunk.
    element_kind: Whether elements are raw values or StoredObject handles.
    schema_version: Manifest schema version for forward compatibility.`,
} as const

export const $CommentCreatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    comment_id: {
      type: "string",
      format: "uuid",
      title: "Comment Id",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    thread_root_id: {
      type: "string",
      format: "uuid",
      title: "Thread Root Id",
    },
    type: {
      type: "string",
      const: "comment_created",
      title: "Type",
      default: "comment_created",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["comment_id", "thread_root_id", "created_at"],
  title: "CommentCreatedEventRead",
  description: "Event for when a top-level comment is created.",
} as const

export const $CommentDeletedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    comment_id: {
      type: "string",
      format: "uuid",
      title: "Comment Id",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    thread_root_id: {
      type: "string",
      format: "uuid",
      title: "Thread Root Id",
    },
    type: {
      type: "string",
      const: "comment_deleted",
      title: "Type",
      default: "comment_deleted",
    },
    delete_mode: {
      $ref: "#/components/schemas/CaseCommentDeleteMode",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["comment_id", "thread_root_id", "delete_mode", "created_at"],
  title: "CommentDeletedEventRead",
  description: "Event for when a top-level comment is deleted.",
} as const

export const $CommentReplyCreatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    comment_id: {
      type: "string",
      format: "uuid",
      title: "Comment Id",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    thread_root_id: {
      type: "string",
      format: "uuid",
      title: "Thread Root Id",
    },
    type: {
      type: "string",
      const: "comment_reply_created",
      title: "Type",
      default: "comment_reply_created",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["comment_id", "thread_root_id", "created_at"],
  title: "CommentReplyCreatedEventRead",
  description: "Event for when a reply is created.",
} as const

export const $CommentReplyDeletedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    comment_id: {
      type: "string",
      format: "uuid",
      title: "Comment Id",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    thread_root_id: {
      type: "string",
      format: "uuid",
      title: "Thread Root Id",
    },
    type: {
      type: "string",
      const: "comment_reply_deleted",
      title: "Type",
      default: "comment_reply_deleted",
    },
    delete_mode: {
      $ref: "#/components/schemas/CaseCommentDeleteMode",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["comment_id", "thread_root_id", "delete_mode", "created_at"],
  title: "CommentReplyDeletedEventRead",
  description: "Event for when a reply is deleted.",
} as const

export const $CommentReplyUpdatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    comment_id: {
      type: "string",
      format: "uuid",
      title: "Comment Id",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    thread_root_id: {
      type: "string",
      format: "uuid",
      title: "Thread Root Id",
    },
    type: {
      type: "string",
      const: "comment_reply_updated",
      title: "Type",
      default: "comment_reply_updated",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["comment_id", "thread_root_id", "created_at"],
  title: "CommentReplyUpdatedEventRead",
  description: "Event for when a reply is updated.",
} as const

export const $CommentUpdatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    comment_id: {
      type: "string",
      format: "uuid",
      title: "Comment Id",
    },
    parent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Id",
    },
    thread_root_id: {
      type: "string",
      format: "uuid",
      title: "Thread Root Id",
    },
    type: {
      type: "string",
      const: "comment_updated",
      title: "Type",
      default: "comment_updated",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["comment_id", "thread_root_id", "created_at"],
  title: "CommentUpdatedEventRead",
  description: "Event for when a top-level comment is updated.",
} as const

export const $ContinueRunRequest = {
  properties: {
    kind: {
      type: "string",
      const: "continue",
      title: "Kind",
      default: "continue",
    },
    decisions: {
      items: {
        $ref: "#/components/schemas/ApprovalDecision",
      },
      type: "array",
      title: "Decisions",
    },
    source: {
      type: "string",
      enum: ["inbox", "slack"],
      title: "Source",
      description:
        "Origin of the approval decision submission. Use 'inbox' for Tracecat UI/API and 'slack' for Slack actions.",
      default: "inbox",
    },
  },
  type: "object",
  required: ["decisions"],
  title: "ContinueRunRequest",
  description: "Payload to continue a CE run after collecting approvals.",
} as const

export const $CreatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "case_created",
      title: "Type",
      default: "case_created",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["created_at"],
  title: "CreatedEventRead",
  description: "Event for when a case is created.",
} as const

export const $CursorPaginatedResponse_AdminOrgInvitationRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/AdminOrgInvitationRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[AdminOrgInvitationRead]",
} as const

export const $CursorPaginatedResponse_AgentFolderRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/AgentFolderRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[AgentFolderRead]",
} as const

export const $CursorPaginatedResponse_AgentPresetVersionReadMinimal_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/AgentPresetVersionReadMinimal",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[AgentPresetVersionReadMinimal]",
} as const

export const $CursorPaginatedResponse_AgentTagRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/AgentTagRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[AgentTagRead]",
} as const

export const $CursorPaginatedResponse_CaseReadMinimal_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/CaseReadMinimal",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[CaseReadMinimal]",
} as const

export const $CursorPaginatedResponse_CaseTableRowRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/CaseTableRowRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[CaseTableRowRead]",
} as const

export const $CursorPaginatedResponse_InboxItemRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/InboxItemRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[InboxItemRead]",
} as const

export const $CursorPaginatedResponse_MCPPersonalAccessTokenRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/MCPPersonalAccessTokenRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[MCPPersonalAccessTokenRead]",
} as const

export const $CursorPaginatedResponse_ServiceAccountApiKeyRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/ServiceAccountApiKeyRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[ServiceAccountApiKeyRead]",
} as const

export const $CursorPaginatedResponse_ServiceAccountRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/ServiceAccountRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[ServiceAccountRead]",
} as const

export const $CursorPaginatedResponse_SkillReadMinimal_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/SkillReadMinimal",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[SkillReadMinimal]",
} as const

export const $CursorPaginatedResponse_SkillVersionReadMinimal_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/SkillVersionReadMinimal",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[SkillVersionReadMinimal]",
} as const

export const $CursorPaginatedResponse_TableRowRead_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/TableRowRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[TableRowRead]",
} as const

export const $CursorPaginatedResponse_WorkflowReadMinimal_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/WorkflowReadMinimal",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[WorkflowReadMinimal]",
} as const

export const $CursorPaginatedResponse_WorkflowRunReadMinimal_ = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/WorkflowRunReadMinimal",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
      description: "Cursor for next page",
    },
    prev_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Prev Cursor",
      description: "Cursor for previous page",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      description: "Whether more items exist",
      default: false,
    },
    has_previous: {
      type: "boolean",
      title: "Has Previous",
      description: "Whether previous items exist",
      default: false,
    },
    total_estimate: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Total Estimate",
      description: "Estimated total count from table statistics",
    },
  },
  type: "object",
  required: ["items"],
  title: "CursorPaginatedResponse[WorkflowRunReadMinimal]",
} as const

export const $CustomOAuthProviderCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 120,
      minLength: 3,
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    grant_type: {
      $ref: "#/components/schemas/OAuthGrantType",
    },
    authorization_endpoint: {
      type: "string",
      minLength: 8,
      title: "Authorization Endpoint",
      description: "OAuth authorization endpoint URL",
    },
    token_endpoint: {
      type: "string",
      minLength: 8,
      title: "Token Endpoint",
      description: "OAuth token endpoint URL",
    },
    scopes: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Scopes",
      description: "Default OAuth scopes to request",
    },
    provider_id: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 3,
        },
        {
          type: "null",
        },
      ],
      title: "Provider Id",
      description: "Optional custom identifier for the provider",
    },
    client_id: {
      type: "string",
      maxLength: 512,
      minLength: 1,
      title: "Client Id",
      description: "OAuth client identifier",
    },
    client_secret: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
          format: "password",
          writeOnly: true,
        },
        {
          type: "null",
        },
      ],
      title: "Client Secret",
      description: "OAuth client secret for the provider",
    },
  },
  type: "object",
  required: [
    "name",
    "grant_type",
    "authorization_endpoint",
    "token_endpoint",
    "client_id",
  ],
  title: "CustomOAuthProviderCreate",
  description: "Request payload for creating a custom OAuth provider.",
} as const

export const $DSLConfig_Input = {
  properties: {
    scheduler: {
      type: "string",
      enum: ["static", "dynamic"],
      title: "Scheduler",
      description: "The type of scheduler to use.",
      default: "dynamic",
    },
    environment: {
      type: "string",
      title: "Environment",
      description:
        "The workflow's target execution environment. This is used to isolate secrets across different environments.If not provided, the default environment (default) is used.",
      default: "default",
    },
    timeout: {
      type: "number",
      title: "Timeout",
      description:
        "Workflow timeout in seconds. If set to 0, the workflow has no timeout.",
      default: 0,
    },
  },
  type: "object",
  title: "DSLConfig",
  description: `This is the runtime configuration for the workflow.

Activities don't need access to this.`,
} as const

export const $DSLConfig_Output = {
  properties: {
    environment: {
      type: "string",
      title: "Environment",
      description:
        "The workflow's target execution environment. This is used to isolate secrets across different environments.If not provided, the default environment (default) is used.",
      default: "default",
    },
    timeout: {
      type: "number",
      title: "Timeout",
      description:
        "Workflow timeout in seconds. If set to 0, the workflow has no timeout.",
      default: 0,
    },
  },
  type: "object",
  title: "DSLConfig",
  description: `This is the runtime configuration for the workflow.

Activities don't need access to this.`,
} as const

export const $DSLEntrypoint = {
  properties: {
    ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
      description: "The entrypoint action ref",
    },
    expects: {
      anyOf: [
        {
          additionalProperties: {
            $ref: "#/components/schemas/ExpectedField-Output",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Expects",
      description:
        "Expected trigger input schema. Use this to specify the expected shape of the trigger input.",
    },
  },
  type: "object",
  title: "DSLEntrypoint",
} as const

export const $DSLEnvironment = {
  properties: {
    workflow: {
      additionalProperties: true,
      type: "object",
      title: "Workflow",
    },
    environment: {
      type: "string",
      title: "Environment",
    },
    variables: {
      additionalProperties: true,
      type: "object",
      title: "Variables",
    },
    registry_version: {
      type: "string",
      title: "Registry Version",
    },
  },
  type: "object",
  title: "DSLEnvironment",
  description: "DSL Environment context. Has metadata about the workflow.",
} as const

export const $DSLInput = {
  properties: {
    title: {
      type: "string",
      title: "Title",
    },
    description: {
      type: "string",
      title: "Description",
    },
    entrypoint: {
      $ref: "#/components/schemas/DSLEntrypoint",
    },
    actions: {
      items: {
        $ref: "#/components/schemas/ActionStatement",
      },
      type: "array",
      title: "Actions",
    },
    config: {
      $ref: "#/components/schemas/DSLConfig-Output",
    },
    triggers: {
      items: {
        $ref: "#/components/schemas/Trigger",
      },
      type: "array",
      title: "Triggers",
    },
    returns: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Returns",
      description: "The action ref or value to return.",
    },
    error_handler: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error Handler",
      description: "The action ref to handle errors.",
    },
  },
  type: "object",
  required: ["title", "description", "entrypoint", "actions"],
  title: "DSLInput",
  description: `DSL definition for a workflow.

The difference between this and a normal workflow engine is that here,
our workflow execution order is defined by the DSL itself, independent
of a workflow scheduler.

With a traditional
This allows the execution of the workflow to be fully deterministic.`,
} as const

export const $DSLRunArgs = {
  properties: {
    role: {
      $ref: "#/components/schemas/Role",
    },
    dsl: {
      anyOf: [
        {
          $ref: "#/components/schemas/DSLInput",
        },
        {
          type: "null",
        },
      ],
    },
    wf_id: {
      type: "string",
      title: "Wf Id",
    },
    trigger_inputs: {
      anyOf: [
        {
          oneOf: [
            {
              $ref: "#/components/schemas/InlineObject",
            },
            {
              $ref: "#/components/schemas/ExternalObject",
            },
            {
              $ref: "#/components/schemas/CollectionObject",
            },
          ],
          discriminator: {
            propertyName: "type",
            mapping: {
              collection: "#/components/schemas/CollectionObject",
              external: "#/components/schemas/ExternalObject",
              inline: "#/components/schemas/InlineObject",
            },
          },
        },
        {
          type: "null",
        },
      ],
      title: "Trigger Inputs",
    },
    parent_run_context: {
      anyOf: [
        {
          $ref: "#/components/schemas/RunContext",
        },
        {
          type: "null",
        },
      ],
    },
    runtime_config: {
      $ref: "#/components/schemas/DSLConfig-Output",
      description:
        "Runtime configuration that can be set on workflow entry. Note that this can override the default config in DSLInput.",
    },
    timeout: {
      type: "string",
      format: "duration",
      title: "Timeout",
      description: "Platform activity start-to-close timeout.",
    },
    schedule_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Schedule Id",
      description:
        "The schedule ID that triggered this workflow, if any. Auto-converts from legacy 'sch-<hex>' format.",
    },
    execution_type: {
      $ref: "#/components/schemas/ExecutionType",
      description:
        "Execution type (draft or published). Draft executions use draft aliases for child workflows.",
      default: "published",
    },
    time_anchor: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Time Anchor",
      description:
        "The workflow's logical time anchor for FN.now() and related functions. If not provided, computed from TemporalScheduledStartTime (for schedules) or workflow start_time (for other triggers). Stored as UTC.",
    },
    registry_lock: {
      anyOf: [
        {
          $ref: "#/components/schemas/RegistryLock",
        },
        {
          type: "null",
        },
      ],
      description:
        "Registry version lock for action execution. Contains origins (origin -> version) and actions (action_name -> origin) mappings.",
    },
  },
  type: "object",
  required: ["role", "wf_id"],
  title: "DSLRunArgs",
} as const

export const $DSLValidationResult = {
  properties: {
    type: {
      type: "string",
      const: "dsl",
      title: "Type",
      default: "dsl",
    },
    status: {
      type: "string",
      enum: ["success", "error"],
      title: "Status",
    },
    msg: {
      type: "string",
      title: "Msg",
      default: "",
    },
    detail: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ValidationDetail",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Detail",
    },
    ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
    },
  },
  type: "object",
  required: ["status"],
  title: "DSLValidationResult",
  description: "Result of validating a generic input.",
} as const

export const $DataUIPart = {
  properties: {
    type: {
      type: "string",
      pattern: "^data-.+$",
      title: "Type",
    },
    id: {
      type: "string",
      title: "Id",
    },
    data: {
      title: "Data",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "data"],
  title: "DataUIPart",
  description: "A custom data part, where type matches 'data-...'.",
} as const

export const $DefaultModelSelection = {
  properties: {
    catalog_id: {
      type: "string",
      format: "uuid",
      title: "Catalog Id",
    },
    model_name: {
      type: "string",
      maxLength: 500,
      minLength: 1,
      title: "Model Name",
    },
    model_provider: {
      type: "string",
      maxLength: 120,
      minLength: 1,
      title: "Model Provider",
    },
    custom_provider_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Custom Provider Id",
    },
  },
  type: "object",
  required: ["catalog_id", "model_name", "model_provider"],
  title: "DefaultModelSelection",
  description: "Canonical default-model selection for an organization.",
} as const

export const $DefaultModelSelectionUpdate = {
  properties: {
    catalog_id: {
      type: "string",
      format: "uuid",
      title: "Catalog Id",
    },
  },
  type: "object",
  required: ["catalog_id"],
  title: "DefaultModelSelectionUpdate",
  description:
    "Payload for updating the organization's default model selection.",
} as const

export const $DocumentUrl = {
  properties: {
    url: {
      type: "string",
      title: "Url",
    },
    force_download: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "string",
          const: "allow-local",
        },
      ],
      title: "Force Download",
      default: false,
    },
    vendor_metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Vendor Metadata",
    },
    kind: {
      type: "string",
      const: "document-url",
      title: "Kind",
      default: "document-url",
    },
    media_type: {
      type: "string",
      title: "Media Type",
      description:
        "Return the media type of the file, based on the URL or the provided `media_type`.",
      readOnly: true,
    },
    identifier: {
      type: "string",
      title: "Identifier",
      description: `The identifier of the file, such as a unique ID.

This identifier can be provided to the model in a message to allow it to refer to this file in a tool call argument,
and the tool can look up the file in question by iterating over the message history and finding the matching \`FileUrl\`.

This identifier is only automatically passed to the model when the \`FileUrl\` is returned by a tool.
If you're passing the \`FileUrl\` as a user message, it's up to you to include a separate text part with the identifier,
e.g. "This is file <identifier>:" preceding the \`FileUrl\`.

It's also included in inline-text delimiters for providers that require inlining text documents, so the model can
distinguish multiple files.`,
      readOnly: true,
    },
  },
  type: "object",
  required: ["url", "media_type", "identifier"],
  title: "DocumentUrl",
  description: "The URL of the document.",
} as const

export const $DropdownValueChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "dropdown_value_changed",
      title: "Type",
      default: "dropdown_value_changed",
    },
    definition_id: {
      type: "string",
      title: "Definition Id",
    },
    definition_ref: {
      type: "string",
      title: "Definition Ref",
    },
    definition_name: {
      type: "string",
      title: "Definition Name",
    },
    old_option_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Old Option Id",
    },
    old_option_label: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Old Option Label",
    },
    new_option_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "New Option Id",
    },
    new_option_label: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "New Option Label",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: [
    "definition_id",
    "definition_ref",
    "definition_name",
    "created_at",
  ],
  title: "DropdownValueChangedEventRead",
  description: "Event for when a case dropdown value is changed.",
} as const

export const $DynamicToolUIPartInputAvailable = {
  properties: {
    type: {
      type: "string",
      const: "dynamic-tool",
      title: "Type",
    },
    toolName: {
      type: "string",
      title: "Toolname",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "input-available",
      title: "State",
    },
    input: {
      title: "Input",
    },
    output: {
      type: "null",
      title: "Output",
    },
    errorText: {
      type: "null",
      title: "Errortext",
    },
    callProviderMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Callprovidermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolName", "toolCallId", "state", "input"],
  title: "DynamicToolUIPartInputAvailable",
} as const

export const $DynamicToolUIPartInputStreaming = {
  properties: {
    type: {
      type: "string",
      const: "dynamic-tool",
      title: "Type",
    },
    toolName: {
      type: "string",
      title: "Toolname",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "input-streaming",
      title: "State",
    },
    input: {
      title: "Input",
    },
    output: {
      type: "null",
      title: "Output",
    },
    errorText: {
      type: "null",
      title: "Errortext",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolName", "toolCallId", "state"],
  title: "DynamicToolUIPartInputStreaming",
} as const

export const $DynamicToolUIPartOutputAvailable = {
  properties: {
    type: {
      type: "string",
      const: "dynamic-tool",
      title: "Type",
    },
    toolName: {
      type: "string",
      title: "Toolname",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "output-available",
      title: "State",
    },
    input: {
      title: "Input",
    },
    output: {
      title: "Output",
    },
    errorText: {
      type: "null",
      title: "Errortext",
    },
    callProviderMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Callprovidermetadata",
    },
    preliminary: {
      type: "boolean",
      title: "Preliminary",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolName", "toolCallId", "state", "input", "output"],
  title: "DynamicToolUIPartOutputAvailable",
} as const

export const $DynamicToolUIPartOutputError = {
  properties: {
    type: {
      type: "string",
      const: "dynamic-tool",
      title: "Type",
    },
    toolName: {
      type: "string",
      title: "Toolname",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "output-error",
      title: "State",
    },
    input: {
      title: "Input",
    },
    output: {
      type: "null",
      title: "Output",
    },
    errorText: {
      type: "string",
      title: "Errortext",
    },
    callProviderMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Callprovidermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolName", "toolCallId", "state", "input", "errorText"],
  title: "DynamicToolUIPartOutputError",
} as const

export const $EditorActionRead = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    ref: {
      type: "string",
      title: "Ref",
    },
    description: {
      type: "string",
      title: "Description",
    },
  },
  type: "object",
  required: ["type", "ref", "description"],
  title: "EditorActionRead",
} as const

export const $EditorComponent = {
  oneOf: [
    {
      $ref: "#/components/schemas/Text",
    },
    {
      $ref: "#/components/schemas/Code",
    },
    {
      $ref: "#/components/schemas/Select",
    },
    {
      $ref: "#/components/schemas/TextArea",
    },
    {
      $ref: "#/components/schemas/Integer",
    },
    {
      $ref: "#/components/schemas/Float",
    },
    {
      $ref: "#/components/schemas/Toggle",
    },
    {
      $ref: "#/components/schemas/Yaml",
    },
    {
      $ref: "#/components/schemas/TagInput",
    },
    {
      $ref: "#/components/schemas/ActionType",
    },
    {
      $ref: "#/components/schemas/WorkflowAlias",
    },
    {
      $ref: "#/components/schemas/AgentPreset",
    },
    {
      $ref: "#/components/schemas/AgentModel",
    },
    {
      $ref: "#/components/schemas/MCPIntegration",
    },
  ],
  title: "EditorComponent",
  discriminator: {
    propertyName: "component_id",
    mapping: {
      "action-type": "#/components/schemas/ActionType",
      "agent-model": "#/components/schemas/AgentModel",
      "agent-preset": "#/components/schemas/AgentPreset",
      code: "#/components/schemas/Code",
      float: "#/components/schemas/Float",
      integer: "#/components/schemas/Integer",
      "mcp-integration": "#/components/schemas/MCPIntegration",
      select: "#/components/schemas/Select",
      "tag-input": "#/components/schemas/TagInput",
      text: "#/components/schemas/Text",
      "text-area": "#/components/schemas/TextArea",
      toggle: "#/components/schemas/Toggle",
      "workflow-alias": "#/components/schemas/WorkflowAlias",
      yaml: "#/components/schemas/Yaml",
    },
  },
} as const

export const $EditorFunctionRead = {
  properties: {
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      type: "string",
      title: "Description",
    },
    parameters: {
      items: {
        $ref: "#/components/schemas/EditorParamRead",
      },
      type: "array",
      title: "Parameters",
    },
    return_type: {
      type: "string",
      title: "Return Type",
    },
  },
  type: "object",
  required: ["name", "description", "parameters", "return_type"],
  title: "EditorFunctionRead",
} as const

export const $EditorParamRead = {
  properties: {
    name: {
      type: "string",
      title: "Name",
    },
    type: {
      type: "string",
      title: "Type",
    },
    optional: {
      type: "boolean",
      title: "Optional",
    },
  },
  type: "object",
  required: ["name", "type", "optional"],
  title: "EditorParamRead",
} as const

export const $EffectiveEntitlements = {
  properties: {
    custom_registry: {
      type: "boolean",
      title: "Custom Registry",
      description: "Whether custom registry repositories are enabled",
      default: false,
    },
    git_sync: {
      type: "boolean",
      title: "Git Sync",
      description: "Whether git sync is enabled",
      default: false,
    },
    agent_addons: {
      type: "boolean",
      title: "Agent Addons",
      description:
        "Whether add-on agent capabilities are enabled (approvals, presets)",
      default: false,
    },
    case_addons: {
      type: "boolean",
      title: "Case Addons",
      description:
        "Whether add-on case capabilities are enabled (dropdowns, durations, tasks, triggers)",
      default: false,
    },
    rbac_addons: {
      type: "boolean",
      title: "Rbac Addons",
      description:
        "Whether RBAC add-ons are enabled (custom roles, groups, and assignments)",
      default: false,
    },
    service_accounts: {
      type: "boolean",
      title: "Service Accounts",
      description: "Whether service accounts for API key access are enabled",
      default: false,
    },
    watchtower: {
      type: "boolean",
      title: "Watchtower",
      description:
        "Whether Watchtower agent monitoring is enabled (agent sessions, tool-call telemetry, and controls)",
      default: false,
    },
  },
  type: "object",
  title: "EffectiveEntitlements",
  description: `Effective feature entitlements for an organization.

Values are resolved from org overrides falling back to tier defaults.`,
} as const

export const $EntitlementsDict = {
  properties: {
    custom_registry: {
      type: "boolean",
      title: "Custom Registry",
      description: "Whether custom registry repositories are enabled",
    },
    git_sync: {
      type: "boolean",
      title: "Git Sync",
      description: "Whether git sync is enabled",
    },
    agent_addons: {
      type: "boolean",
      title: "Agent Addons",
      description:
        "Whether add-on agent capabilities are enabled (approvals, presets)",
    },
    case_addons: {
      type: "boolean",
      title: "Case Addons",
      description:
        "Whether add-on case capabilities are enabled (dropdowns, durations, tasks, triggers)",
    },
    rbac_addons: {
      type: "boolean",
      title: "Rbac Addons",
      description:
        "Whether RBAC add-ons are enabled (custom roles, groups, and assignments)",
    },
    service_accounts: {
      type: "boolean",
      title: "Service Accounts",
      description: "Whether service accounts for API key access are enabled",
    },
    watchtower: {
      type: "boolean",
      title: "Watchtower",
      description:
        "Whether Watchtower agent monitoring is enabled (agent sessions, tool-call telemetry, and controls)",
    },
  },
  type: "object",
  title: "EntitlementsDict",
  description: `TypedDict for tier entitlements stored in JSONB.

All keys are optional (total=False) to support partial overrides.`,
} as const

export const $ErrorDetails = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    loc: {
      items: {
        anyOf: [
          {
            type: "integer",
          },
          {
            type: "string",
          },
        ],
      },
      type: "array",
      title: "Loc",
    },
    msg: {
      type: "string",
      title: "Msg",
    },
    input: {
      title: "Input",
    },
    ctx: {
      additionalProperties: true,
      type: "object",
      title: "Ctx",
    },
    url: {
      type: "string",
      title: "Url",
    },
  },
  type: "object",
  required: ["type", "loc", "msg", "input"],
  title: "ErrorDetails",
} as const

export const $ErrorModel = {
  properties: {
    detail: {
      anyOf: [
        {
          type: "string",
        },
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
      ],
      title: "Detail",
    },
  },
  type: "object",
  required: ["detail"],
  title: "ErrorModel",
} as const

export const $EventFailure = {
  properties: {
    message: {
      type: "string",
      title: "Message",
    },
    cause: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Cause",
    },
    root_cause_message: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Root Cause Message",
    },
  },
  type: "object",
  required: ["message"],
  title: "EventFailure",
} as const

export const $EventGroup_TypeVar_ = {
  properties: {
    event_id: {
      type: "integer",
      title: "Event Id",
    },
    udf_namespace: {
      type: "string",
      title: "Udf Namespace",
    },
    udf_name: {
      type: "string",
      title: "Udf Name",
    },
    udf_key: {
      type: "string",
      title: "Udf Key",
    },
    action_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Action Id",
    },
    action_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Action Ref",
    },
    action_title: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Action Title",
    },
    action_description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Action Description",
    },
    action_input: {
      anyOf: [
        {
          $ref: "#/components/schemas/RunActionInput",
        },
        {
          $ref: "#/components/schemas/DSLRunArgs",
        },
        {
          $ref: "#/components/schemas/GetWorkflowDefinitionActivityInputs",
        },
        {
          $ref: "#/components/schemas/InteractionResult",
        },
        {
          $ref: "#/components/schemas/InteractionInput",
        },
        {
          $ref: "#/components/schemas/UnreadableTemporalPayload",
        },
      ],
      title: "Action Input",
    },
    action_result: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Action Result",
    },
    current_attempt: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Current Attempt",
    },
    retry_policy: {
      $ref: "#/components/schemas/ActionRetryPolicy",
    },
    start_delay: {
      type: "number",
      title: "Start Delay",
      default: 0,
    },
    join_strategy: {
      $ref: "#/components/schemas/JoinStrategy",
      default: "all",
    },
    related_wf_exec_id: {
      anyOf: [
        {
          type: "string",
          pattern:
            "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
        },
        {
          type: "string",
          pattern: "^agent/[0-9a-f]8-[0-9a-f]4-[0-9a-f]4-[0-9a-f]4-[0-9a-f]12$",
        },
        {
          type: "null",
        },
      ],
      title: "Related Wf Exec Id",
    },
  },
  type: "object",
  required: [
    "event_id",
    "udf_namespace",
    "udf_name",
    "udf_key",
    "action_input",
  ],
  title: "EventGroup[TypeVar]",
} as const

export const $ExecutionContext = {
  properties: {
    ACTIONS: {
      additionalProperties: {
        $ref: "#/components/schemas/TaskResult",
      },
      type: "object",
      title: "Actions",
    },
    TRIGGER: {
      anyOf: [
        {
          oneOf: [
            {
              $ref: "#/components/schemas/InlineObject",
            },
            {
              $ref: "#/components/schemas/ExternalObject",
            },
            {
              $ref: "#/components/schemas/CollectionObject",
            },
          ],
          discriminator: {
            propertyName: "type",
            mapping: {
              collection: "#/components/schemas/CollectionObject",
              external: "#/components/schemas/ExternalObject",
              inline: "#/components/schemas/InlineObject",
            },
          },
        },
        {
          type: "null",
        },
      ],
      title: "Trigger",
    },
    ENV: {
      $ref: "#/components/schemas/DSLEnvironment",
    },
    SECRETS: {
      additionalProperties: true,
      type: "object",
      title: "Secrets",
    },
    VARS: {
      additionalProperties: true,
      type: "object",
      title: "Vars",
    },
    var: {
      additionalProperties: true,
      type: "object",
      title: "Var",
    },
  },
  type: "object",
  required: ["ACTIONS", "TRIGGER"],
  title: "ExecutionContext",
  description: `Workflow execution context with typed fields.

ACTIONS and TRIGGER are always present. Other fields are optional since
contexts may be built incrementally during workflow execution.`,
} as const

export const $ExecutionType = {
  type: "string",
  enum: ["draft", "published"],
  title: "ExecutionType",
  description: `Execution type for a workflow execution.

Distinguishes between draft (development) and published (production) executions.`,
} as const

export const $ExpectedField_Input = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    default: {
      title: "Default",
    },
    enum: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Enum",
    },
    optional: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Optional",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type"],
  title: "ExpectedField",
  description: `Schema for a field in a template action's expects definition.

Note: The default field uses a sentinel to distinguish between
"no default specified" (required field) and "default is explicitly None"
(optional field).`,
} as const

export const $ExpectedField_Output = {
  additionalProperties: true,
  type: "object",
} as const

export const $ExprType = {
  type: "string",
  enum: [
    "generic",
    "action",
    "secret",
    "function",
    "input",
    "env",
    "local_vars",
    "literal",
    "typecast",
    "iterator",
    "ternary",
    "trigger",
    "template_action_step",
    "template_action_input",
    "variable",
  ],
  title: "ExprType",
} as const

export const $ExprValidationResult = {
  properties: {
    type: {
      type: "string",
      const: "expression",
      title: "Type",
      default: "expression",
    },
    status: {
      type: "string",
      enum: ["success", "error"],
      title: "Status",
    },
    msg: {
      type: "string",
      title: "Msg",
      default: "",
    },
    detail: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ValidationDetail",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Detail",
    },
    ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
    },
    expression: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Expression",
    },
    expression_type: {
      $ref: "#/components/schemas/ExprType",
    },
  },
  type: "object",
  required: ["status", "expression_type"],
  title: "ExprValidationResult",
  description: "Result of visiting an expression node.",
} as const

export const $ExpressionValidationRequest = {
  properties: {
    expression: {
      type: "string",
      title: "Expression",
    },
  },
  type: "object",
  required: ["expression"],
  title: "ExpressionValidationRequest",
} as const

export const $ExpressionValidationResponse = {
  properties: {
    is_valid: {
      type: "boolean",
      title: "Is Valid",
    },
    errors: {
      items: {
        $ref: "#/components/schemas/ValidationError",
      },
      type: "array",
      title: "Errors",
      default: [],
    },
    tokens: {
      items: {
        $ref: "#/components/schemas/SyntaxToken",
      },
      type: "array",
      title: "Tokens",
      default: [],
    },
  },
  type: "object",
  required: ["is_valid"],
  title: "ExpressionValidationResponse",
} as const

export const $ExternalObject = {
  properties: {
    typename: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Typename",
    },
    type: {
      type: "string",
      const: "external",
      title: "Type",
    },
    ref: {
      $ref: "#/components/schemas/ObjectRef",
    },
  },
  type: "object",
  required: ["type", "ref"],
  title: "ExternalObject",
  description: "Data externalized to blob storage.",
} as const

export const $FeatureFlag = {
  type: "string",
  enum: ["ai-ranking", "workflow-concurrency-limits", "agent-channels"],
  title: "FeatureFlag",
  description: "Feature flag enum reserved for engineering rollouts.",
} as const

export const $FeatureFlagsRead = {
  properties: {
    enabled_features: {
      items: {
        $ref: "#/components/schemas/FeatureFlag",
      },
      type: "array",
      title: "Enabled Features",
    },
  },
  type: "object",
  required: ["enabled_features"],
  title: "FeatureFlagsRead",
  description: "Response model for feature flags.",
} as const

export const $FieldChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "fields_changed",
      title: "Type",
      default: "fields_changed",
    },
    changes: {
      items: {
        $ref: "#/components/schemas/FieldDiff",
      },
      type: "array",
      title: "Changes",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["changes", "created_at"],
  title: "FieldChangedEventRead",
  description: "Event for when a case field is changed.",
} as const

export const $FieldDiff = {
  properties: {
    field: {
      type: "string",
      title: "Field",
    },
    old: {
      title: "Old",
    },
    new: {
      title: "New",
    },
  },
  type: "object",
  required: ["field", "old", "new"],
  title: "FieldDiff",
} as const

export const $FileUIPart = {
  properties: {
    type: {
      type: "string",
      const: "file",
      title: "Type",
    },
    mediaType: {
      type: "string",
      title: "Mediatype",
    },
    url: {
      type: "string",
      title: "Url",
    },
    filename: {
      type: "string",
      title: "Filename",
    },
    providerMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Providermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "mediaType", "url"],
  title: "FileUIPart",
  description: "A file part of a message.",
} as const

export const $Float = {
  properties: {
    component_id: {
      type: "string",
      const: "float",
      title: "Component Id",
      default: "float",
    },
    min_val: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Min Val",
    },
    max_val: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Max Val",
    },
    step: {
      type: "number",
      title: "Step",
      default: 0.1,
    },
  },
  type: "object",
  title: "Float",
} as const

export const $FolderDirectoryItem = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    path: {
      type: "string",
      title: "Path",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    type: {
      type: "string",
      const: "folder",
      title: "Type",
    },
    num_items: {
      type: "integer",
      title: "Num Items",
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "path",
    "workspace_id",
    "created_at",
    "updated_at",
    "type",
    "num_items",
  ],
  title: "FolderDirectoryItem",
} as const

export const $GetWorkflowDefinitionActivityInputs = {
  properties: {
    role: {
      $ref: "#/components/schemas/Role",
    },
    workflow_id: {
      type: "string",
      title: "Workflow Id",
    },
    version: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Version",
    },
    task: {
      anyOf: [
        {
          $ref: "#/components/schemas/ActionStatement",
        },
        {
          type: "null",
        },
      ],
    },
  },
  type: "object",
  required: ["role", "workflow_id"],
  title: "GetWorkflowDefinitionActivityInputs",
} as const

export const $GitBranchInfo = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Name",
      description: "Branch name",
    },
    is_default: {
      type: "boolean",
      title: "Is Default",
      description: "Whether this branch is the repository default branch",
      default: false,
    },
  },
  type: "object",
  required: ["name"],
  title: "GitBranchInfo",
  description: "Git branch information for repository management.",
} as const

export const $GitCommitInfo = {
  properties: {
    sha: {
      type: "string",
      maxLength: 40,
      minLength: 40,
      title: "Sha",
      description: "The commit SHA hash",
    },
    message: {
      type: "string",
      title: "Message",
      description: "The commit message",
    },
    author: {
      type: "string",
      maxLength: 255,
      title: "Author",
      description: "The commit author name",
    },
    author_email: {
      type: "string",
      maxLength: 255,
      title: "Author Email",
      description: "The commit author email",
    },
    date: {
      type: "string",
      maxLength: 50,
      title: "Date",
      description: "The commit date in ISO format",
    },
    tags: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Tags",
      description: "List of tags associated with this commit",
    },
  },
  type: "object",
  required: ["sha", "message", "author", "author_email", "date"],
  title: "GitCommitInfo",
  description: "Git commit information for repository management.",
} as const

export const $GitHubAppCredentialsRequest = {
  properties: {
    app_id: {
      type: "string",
      title: "App Id",
      description: "GitHub App ID",
    },
    private_key: {
      type: "string",
      format: "password",
      title: "Private Key",
      description: "GitHub App private key in PEM format",
      writeOnly: true,
    },
    webhook_secret: {
      anyOf: [
        {
          type: "string",
          format: "password",
          writeOnly: true,
        },
        {
          type: "null",
        },
      ],
      title: "Webhook Secret",
      description: "GitHub App webhook secret",
    },
    client_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Client Id",
      description: "GitHub App client ID",
    },
  },
  type: "object",
  required: ["app_id", "private_key"],
  title: "GitHubAppCredentialsRequest",
  description: "Request to register or update GitHub App credentials.",
} as const

export const $GitHubAppCredentialsStatus = {
  properties: {
    exists: {
      type: "boolean",
      title: "Exists",
    },
    is_corrupted: {
      type: "boolean",
      title: "Is Corrupted",
      default: false,
    },
    app_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "App Id",
    },
    has_webhook_secret: {
      type: "boolean",
      title: "Has Webhook Secret",
      default: false,
    },
    webhook_secret_preview: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Webhook Secret Preview",
    },
    client_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Client Id",
    },
    created_at: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Created At",
    },
  },
  type: "object",
  required: ["exists"],
  title: "GitHubAppCredentialsStatus",
  description: "Status of GitHub App credentials.",
} as const

export const $GitHubAppManifest = {
  properties: {
    name: {
      type: "string",
      title: "Name",
    },
    url: {
      type: "string",
      title: "Url",
    },
    hook_attributes: {
      $ref: "#/components/schemas/GitHubWebhookAttributes",
    },
    redirect_url: {
      type: "string",
      title: "Redirect Url",
    },
    callback_urls: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Callback Urls",
    },
    setup_url: {
      type: "string",
      title: "Setup Url",
    },
    description: {
      type: "string",
      title: "Description",
    },
    public: {
      type: "boolean",
      title: "Public",
    },
    default_permissions: {
      $ref: "#/components/schemas/GitHubAppPermissions",
    },
    default_events: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Default Events",
    },
  },
  type: "object",
  required: [
    "name",
    "url",
    "hook_attributes",
    "redirect_url",
    "callback_urls",
    "setup_url",
    "description",
    "public",
    "default_permissions",
    "default_events",
  ],
  title: "GitHubAppManifest",
  description: "GitHub App manifest for creating enterprise apps.",
} as const

export const $GitHubAppManifestResponse = {
  properties: {
    manifest: {
      $ref: "#/components/schemas/GitHubAppManifest",
    },
    instructions: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Instructions",
    },
  },
  type: "object",
  required: ["manifest", "instructions"],
  title: "GitHubAppManifestResponse",
  description: "GitHub App manifest response.",
} as const

export const $GitHubAppPermissions = {
  properties: {
    contents: {
      type: "string",
      title: "Contents",
    },
    metadata: {
      type: "string",
      title: "Metadata",
    },
    pull_requests: {
      type: "string",
      title: "Pull Requests",
    },
  },
  type: "object",
  required: ["contents", "metadata", "pull_requests"],
  title: "GitHubAppPermissions",
  description: "Type definition for GitHub App default permissions.",
} as const

export const $GitHubWebhookAttributes = {
  properties: {
    url: {
      type: "string",
      title: "Url",
    },
    active: {
      type: "boolean",
      title: "Active",
    },
  },
  type: "object",
  required: ["url", "active"],
  title: "GitHubWebhookAttributes",
  description: "Type definition for GitHub webhook attributes.",
} as const

export const $GitSettingsRead = {
  properties: {
    git_allowed_domains: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Git Allowed Domains",
    },
    git_repo_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Url",
    },
    git_repo_package_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Package Name",
    },
  },
  type: "object",
  required: ["git_allowed_domains"],
  title: "GitSettingsRead",
} as const

export const $GitSettingsUpdate = {
  properties: {
    git_allowed_domains: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Git Allowed Domains",
      description: "Allowed git domains for authentication.",
    },
    git_repo_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Url",
    },
    git_repo_package_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Package Name",
    },
  },
  type: "object",
  title: "GitSettingsUpdate",
} as const

export const $GraphOperation = {
  properties: {
    type: {
      $ref: "#/components/schemas/GraphOperationType",
    },
    payload: {
      additionalProperties: true,
      type: "object",
      title: "Payload",
      description: "Operation-specific payload",
    },
  },
  type: "object",
  required: ["type", "payload"],
  title: "GraphOperation",
  description: "A single graph operation.",
} as const

export const $GraphOperationType = {
  type: "string",
  enum: [
    "add_node",
    "update_node",
    "delete_node",
    "add_edge",
    "delete_edge",
    "move_nodes",
    "update_trigger_position",
    "update_viewport",
  ],
  title: "GraphOperationType",
  description: "Graph operation types.",
} as const

export const $GraphOperationsRequest = {
  properties: {
    base_version: {
      type: "integer",
      title: "Base Version",
      description: "Expected current graph_version. Returns 409 if mismatched.",
    },
    operations: {
      items: {
        $ref: "#/components/schemas/GraphOperation",
      },
      type: "array",
      title: "Operations",
      description: "List of operations to apply atomically",
    },
  },
  type: "object",
  required: ["base_version", "operations"],
  title: "GraphOperationsRequest",
  description: `Request for PATCH /workflows/{id}/graph.

Applies a batch of graph operations with optimistic concurrency.`,
} as const

export const $GraphResponse = {
  properties: {
    version: {
      type: "integer",
      title: "Version",
      description: "Graph version for optimistic concurrency",
    },
    nodes: {
      items: {
        additionalProperties: true,
        type: "object",
      },
      type: "array",
      title: "Nodes",
      description: "React Flow nodes",
    },
    edges: {
      items: {
        additionalProperties: true,
        type: "object",
      },
      type: "array",
      title: "Edges",
      description: "React Flow edges",
    },
    viewport: {
      additionalProperties: true,
      type: "object",
      title: "Viewport",
    },
  },
  type: "object",
  required: ["version", "nodes", "edges"],
  title: "GraphResponse",
  description: `Response for GET /workflows/{id}/graph.

Returns the canonical graph projection from Actions.`,
} as const

export const $GroupCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 128,
      minLength: 1,
      title: "Name",
      description: "Group name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description of the group",
    },
  },
  type: "object",
  required: ["name"],
  title: "GroupCreate",
  description: "Create schema for a group.",
} as const

export const $GroupList = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/GroupReadWithMembers",
      },
      type: "array",
      title: "Items",
    },
    total: {
      type: "integer",
      title: "Total",
    },
  },
  type: "object",
  required: ["items", "total"],
  title: "GroupList",
  description: "Response schema for listing groups.",
} as const

export const $GroupMemberAdd = {
  properties: {
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
      description: "User ID to add to the group",
    },
  },
  type: "object",
  required: ["user_id"],
  title: "GroupMemberAdd",
  description: "Schema for adding a member to a group.",
} as const

export const $GroupMemberRead = {
  properties: {
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
    },
    email: {
      type: "string",
      title: "Email",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    added_at: {
      type: "string",
      format: "date-time",
      title: "Added At",
    },
  },
  type: "object",
  required: ["user_id", "email", "added_at"],
  title: "GroupMemberRead",
  description: "Read schema for a group member.",
} as const

export const $GroupReadWithMembers = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
    },
    members: {
      items: {
        $ref: "#/components/schemas/GroupMemberRead",
      },
      type: "array",
      title: "Members",
    },
    member_count: {
      type: "integer",
      title: "Member Count",
      default: 0,
    },
  },
  type: "object",
  required: ["id", "name", "organization_id", "created_at", "updated_at"],
  title: "GroupReadWithMembers",
  description: "Read schema for a group with its members.",
} as const

export const $GroupRoleAssignmentCreate = {
  properties: {
    group_id: {
      type: "string",
      format: "uuid",
      title: "Group Id",
      description: "Group ID to assign",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
      description: "Role ID to assign to the group",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
      description:
        "Workspace ID for workspace-level assignment. If None, creates org-wide assignment.",
    },
  },
  type: "object",
  required: ["group_id", "role_id"],
  title: "GroupRoleAssignmentCreate",
  description: "Create schema for a group assignment.",
} as const

export const $GroupRoleAssignmentList = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/GroupRoleAssignmentReadWithDetails",
      },
      type: "array",
      title: "Items",
    },
    total: {
      type: "integer",
      title: "Total",
    },
  },
  type: "object",
  required: ["items", "total"],
  title: "GroupRoleAssignmentList",
  description: "Response schema for listing group assignments.",
} as const

export const $GroupRoleAssignmentReadWithDetails = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    group_id: {
      type: "string",
      format: "uuid",
      title: "Group Id",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
    },
    assigned_at: {
      type: "string",
      format: "date-time",
      title: "Assigned At",
    },
    assigned_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Assigned By",
    },
    group_name: {
      type: "string",
      title: "Group Name",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    workspace_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Name",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "group_id",
    "role_id",
    "assigned_at",
    "group_name",
    "role_name",
  ],
  title: "GroupRoleAssignmentReadWithDetails",
  description:
    "Read schema for a group assignment with group and role details.",
} as const

export const $GroupRoleAssignmentUpdate = {
  properties: {
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
      description: "New role ID to assign",
    },
  },
  type: "object",
  required: ["role_id"],
  title: "GroupRoleAssignmentUpdate",
  description: "Update schema for a group assignment (change role only).",
} as const

export const $GroupUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 128,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
      description: "Group name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description of the group",
    },
  },
  type: "object",
  title: "GroupUpdate",
  description: "Update schema for a group.",
} as const

export const $HTTPValidationError = {
  properties: {
    detail: {
      items: {
        $ref: "#/components/schemas/ValidationError",
      },
      type: "array",
      title: "Detail",
    },
  },
  type: "object",
  title: "HTTPValidationError",
} as const

export const $HarnessType = {
  type: "string",
  enum: ["pydantic-ai", "claude_code"],
  title: "HarnessType",
  description: "Supported agent harnesses.",
} as const

export const $HealthResponse = {
  properties: {
    status: {
      type: "string",
      title: "Status",
    },
  },
  type: "object",
  required: ["status"],
  title: "HealthResponse",
} as const

export const $ImageUrl = {
  properties: {
    url: {
      type: "string",
      title: "Url",
    },
    force_download: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "string",
          const: "allow-local",
        },
      ],
      title: "Force Download",
      default: false,
    },
    vendor_metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Vendor Metadata",
    },
    kind: {
      type: "string",
      const: "image-url",
      title: "Kind",
      default: "image-url",
    },
    media_type: {
      type: "string",
      title: "Media Type",
      description:
        "Return the media type of the file, based on the URL or the provided `media_type`.",
      readOnly: true,
    },
    identifier: {
      type: "string",
      title: "Identifier",
      description: `The identifier of the file, such as a unique ID.

This identifier can be provided to the model in a message to allow it to refer to this file in a tool call argument,
and the tool can look up the file in question by iterating over the message history and finding the matching \`FileUrl\`.

This identifier is only automatically passed to the model when the \`FileUrl\` is returned by a tool.
If you're passing the \`FileUrl\` as a user message, it's up to you to include a separate text part with the identifier,
e.g. "This is file <identifier>:" preceding the \`FileUrl\`.

It's also included in inline-text delimiters for providers that require inlining text documents, so the model can
distinguish multiple files.`,
      readOnly: true,
    },
  },
  type: "object",
  required: ["url", "media_type", "identifier"],
  title: "ImageUrl",
  description: "A URL to an image.",
} as const

export const $InboxItemRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
      description: "Unique inbox item ID",
    },
    type: {
      $ref: "#/components/schemas/InboxItemType",
      description: "Type of inbox item",
    },
    title: {
      type: "string",
      title: "Title",
      description: "Display title",
    },
    preview: {
      type: "string",
      title: "Preview",
      description: "Preview text",
    },
    status: {
      $ref: "#/components/schemas/InboxItemStatus",
      description: "Item status",
    },
    unread: {
      type: "boolean",
      title: "Unread",
      description: "Whether the item is unread",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "Creation timestamp",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
      description: "Last update timestamp",
    },
    workflow: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkflowSummary",
        },
        {
          type: "null",
        },
      ],
      description: "Associated workflow",
    },
    source_id: {
      type: "string",
      format: "uuid",
      title: "Source Id",
      description: "ID of the source entity",
    },
    source_type: {
      type: "string",
      title: "Source Type",
      description: "Type of source entity (e.g., agent_session)",
    },
    metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Metadata",
      description: "Type-specific metadata",
    },
  },
  type: "object",
  required: [
    "id",
    "type",
    "title",
    "preview",
    "status",
    "unread",
    "created_at",
    "updated_at",
    "source_id",
    "source_type",
  ],
  title: "InboxItemRead",
  description: "Read model for inbox items.",
} as const

export const $InboxItemStatus = {
  type: "string",
  enum: ["pending", "completed", "failed"],
  title: "InboxItemStatus",
  description: "Status of inbox items.",
} as const

export const $InboxItemType = {
  type: "string",
  enum: ["approval"],
  title: "InboxItemType",
  description: "Types of inbox items.",
} as const

export const $InboxPendingCount = {
  properties: {
    count: {
      type: "integer",
      minimum: 0,
      title: "Count",
      description: "Number of pending inbox items",
    },
  },
  type: "object",
  required: ["count"],
  title: "InboxPendingCount",
  description: "Count of pending inbox items that require attention.",
} as const

export const $InferredColumn = {
  properties: {
    csv_header: {
      type: "string",
      title: "Csv Header",
      description: "Original column header in the CSV file",
    },
    field_name: {
      type: "string",
      title: "Field Name",
      description: "Column name created in Tracecat",
    },
    field_type: {
      $ref: "#/components/schemas/SqlType",
      description: "Inferred SQL type for the column",
    },
  },
  type: "object",
  required: ["csv_header", "field_name", "field_type"],
  title: "InferredColumn",
  description: "Inferred column mapping between CSV headers and table columns.",
} as const

export const $InlineObject = {
  properties: {
    typename: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Typename",
    },
    type: {
      type: "string",
      const: "inline",
      title: "Type",
    },
    data: {
      title: "Data",
    },
  },
  type: "object",
  required: ["type", "data"],
  title: "InlineObject",
  description: "Data stored inline (not externalized).",
} as const

export const $Integer = {
  properties: {
    component_id: {
      type: "string",
      const: "integer",
      title: "Component Id",
      default: "integer",
    },
    min_val: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Min Val",
    },
    max_val: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Val",
    },
    step: {
      type: "integer",
      title: "Step",
      default: 1,
    },
  },
  type: "object",
  title: "Integer",
} as const

export const $IntegrationOAuthCallback = {
  properties: {
    status: {
      type: "string",
      title: "Status",
      description: "The status of the OAuth callback",
      default: "connected",
    },
    provider_id: {
      type: "string",
      title: "Provider Id",
      description: "The provider that the user connected to",
    },
    redirect_url: {
      type: "string",
      title: "Redirect Url",
      description: "The URL to redirect to after the OAuth callback",
    },
  },
  type: "object",
  required: ["provider_id", "redirect_url"],
  title: "IntegrationOAuthCallback",
  description: "Response for OAuth callback.",
} as const

export const $IntegrationOAuthConnect = {
  properties: {
    auth_url: {
      type: "string",
      title: "Auth Url",
      description: "The URL to redirect to for OAuth authentication",
    },
    provider_id: {
      type: "string",
      title: "Provider Id",
      description: "The provider that the user connected to",
    },
  },
  type: "object",
  required: ["auth_url", "provider_id"],
  title: "IntegrationOAuthConnect",
  description: "Request model for connecting an integration.",
} as const

export const $IntegrationRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
    },
    provider_id: {
      type: "string",
      title: "Provider Id",
    },
    authorization_endpoint: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Authorization Endpoint",
      description:
        "OAuth authorization endpoint configured for this integration.",
    },
    token_endpoint: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Token Endpoint",
      description: "OAuth token endpoint configured for this integration.",
    },
    token_type: {
      type: "string",
      title: "Token Type",
    },
    expires_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Expires At",
    },
    client_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Client Id",
      description: "OAuth client ID for the provider",
    },
    granted_scopes: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Granted Scopes",
      description: "OAuth scopes granted for this integration",
    },
    requested_scopes: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Requested Scopes",
      description: "OAuth scopes requested by user for this integration",
    },
    status: {
      $ref: "#/components/schemas/IntegrationStatus",
    },
    is_expired: {
      type: "boolean",
      title: "Is Expired",
    },
  },
  type: "object",
  required: [
    "id",
    "created_at",
    "updated_at",
    "provider_id",
    "token_type",
    "expires_at",
    "status",
    "is_expired",
  ],
  title: "IntegrationRead",
  description: "Response model for user integration.",
} as const

export const $IntegrationReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
    },
    provider_id: {
      type: "string",
      title: "Provider Id",
    },
    status: {
      $ref: "#/components/schemas/IntegrationStatus",
    },
    is_expired: {
      type: "boolean",
      title: "Is Expired",
    },
  },
  type: "object",
  required: ["id", "provider_id", "status", "is_expired"],
  title: "IntegrationReadMinimal",
  description: "Response model for user integration.",
} as const

export const $IntegrationStatus = {
  type: "string",
  enum: ["not_configured", "configured", "connected"],
  title: "IntegrationStatus",
  description: "Status of an integration.",
} as const

export const $IntegrationTestConnectionResponse = {
  properties: {
    success: {
      type: "boolean",
      title: "Success",
      description: "Whether the connection test was successful",
    },
    provider_id: {
      type: "string",
      title: "Provider Id",
      description: "The provider that was tested",
    },
    message: {
      type: "string",
      title: "Message",
      description: "Message describing the test result",
    },
    error: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error",
      description: "Error message if the test failed",
    },
  },
  type: "object",
  required: ["success", "provider_id", "message"],
  title: "IntegrationTestConnectionResponse",
  description: "Response for testing integration connection.",
} as const

export const $IntegrationUpdate = {
  properties: {
    grant_type: {
      $ref: "#/components/schemas/OAuthGrantType",
      description: "OAuth grant type for this integration",
    },
    client_id: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Client Id",
      description: "OAuth client ID for the provider",
    },
    client_secret: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
          format: "password",
          writeOnly: true,
        },
        {
          type: "null",
        },
      ],
      title: "Client Secret",
      description: "OAuth client secret for the provider",
    },
    authorization_endpoint: {
      anyOf: [
        {
          type: "string",
          minLength: 8,
        },
        {
          type: "null",
        },
      ],
      title: "Authorization Endpoint",
      description:
        "OAuth authorization endpoint URL. Overrides provider defaults when set.",
    },
    token_endpoint: {
      anyOf: [
        {
          type: "string",
          minLength: 8,
        },
        {
          type: "null",
        },
      ],
      title: "Token Endpoint",
      description:
        "OAuth token endpoint URL. Overrides provider defaults when set.",
    },
    scopes: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Scopes",
      description: "OAuth scopes to request for this integration",
    },
  },
  type: "object",
  required: ["grant_type"],
  title: "IntegrationUpdate",
  description: "Request model for updating an integration.",
} as const

export const $InteractionCategory = {
  type: "string",
  enum: ["slack"],
  title: "InteractionCategory",
} as const

export const $InteractionContext = {
  properties: {
    interaction_id: {
      type: "string",
      format: "uuid",
      title: "Interaction Id",
    },
    execution_id: {
      type: "string",
      pattern:
        "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      title: "Execution Id",
    },
    action_ref: {
      type: "string",
      title: "Action Ref",
    },
  },
  type: "object",
  required: ["interaction_id", "execution_id", "action_ref"],
  title: "InteractionContext",
  description: "The context of the interaction.",
} as const

export const $InteractionInput = {
  properties: {
    interaction_id: {
      type: "string",
      format: "uuid",
      title: "Interaction Id",
    },
    execution_id: {
      type: "string",
      pattern:
        "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      title: "Execution Id",
    },
    action_ref: {
      type: "string",
      title: "Action Ref",
    },
    data: {
      additionalProperties: true,
      type: "object",
      title: "Data",
    },
  },
  type: "object",
  required: ["interaction_id", "execution_id", "action_ref", "data"],
  title: "InteractionInput",
  description:
    "Input for the workflow interaction handler. This is used on the client side.",
} as const

export const $InteractionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    type: {
      $ref: "#/components/schemas/InteractionType",
    },
    status: {
      $ref: "#/components/schemas/InteractionStatus",
    },
    request_payload: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Request Payload",
    },
    response_payload: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Response Payload",
    },
    expires_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Expires At",
    },
    wf_exec_id: {
      type: "string",
      pattern:
        "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      title: "Wf Exec Id",
    },
    actor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Actor",
    },
    action_ref: {
      type: "string",
      title: "Action Ref",
    },
    action_type: {
      type: "string",
      title: "Action Type",
    },
  },
  type: "object",
  required: [
    "id",
    "created_at",
    "updated_at",
    "type",
    "status",
    "request_payload",
    "response_payload",
    "wf_exec_id",
    "actor",
    "action_ref",
    "action_type",
  ],
  title: "InteractionRead",
  description: "Model for reading an interaction.",
} as const

export const $InteractionResult = {
  properties: {
    message: {
      type: "string",
      title: "Message",
    },
    detail: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Detail",
    },
  },
  type: "object",
  required: ["message"],
  title: "InteractionResult",
  description:
    "Output for the workflow interaction handler. This is used on the client side.",
} as const

export const $InteractionStatus = {
  type: "string",
  enum: ["idle", "pending", "error", "timed_out", "completed"],
  title: "InteractionStatus",
} as const

export const $InteractionType = {
  type: "string",
  enum: ["approval", "response"],
  title: "InteractionType",
} as const

export const $InvitationStatus = {
  type: "string",
  enum: ["pending", "accepted", "revoked"],
  title: "InvitationStatus",
  description: "Invitation lifecycle status.",
} as const

export const $IssuedMCPPersonalAccessToken = {
  properties: {
    raw_token: {
      type: "string",
      title: "Raw Token",
    },
    token: {
      $ref: "#/components/schemas/MCPPersonalAccessTokenRead",
    },
  },
  type: "object",
  required: ["raw_token", "token"],
  title: "IssuedMCPPersonalAccessToken",
} as const

export const $IssuedServiceAccountApiKey = {
  properties: {
    raw_key: {
      type: "string",
      title: "Raw Key",
    },
    api_key: {
      $ref: "#/components/schemas/ServiceAccountApiKeyRead",
    },
  },
  type: "object",
  required: ["raw_key", "api_key"],
  title: "IssuedServiceAccountApiKey",
} as const

export const $JoinStrategy = {
  type: "string",
  enum: ["any", "all"],
  title: "JoinStrategy",
} as const

export const $MCPAuthType = {
  type: "string",
  enum: ["OAUTH2", "CUSTOM", "NONE"],
  title: "MCPAuthType",
  description: "Authentication type for MCP integrations.",
} as const

export const $MCPHttpIntegrationCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 3,
      title: "Name",
      description: "MCP integration name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description",
    },
    timeout: {
      anyOf: [
        {
          type: "integer",
          maximum: 300,
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Timeout",
      description: "Timeout in seconds",
      default: 30,
    },
    server_type: {
      type: "string",
      const: "http",
      title: "Server Type",
      default: "http",
    },
    server_uri: {
      type: "string",
      title: "Server Uri",
      description: "MCP server endpoint URL (required for http type)",
    },
    auth_type: {
      $ref: "#/components/schemas/MCPAuthType",
      description: "Authentication type (for http type)",
      default: "NONE",
    },
    oauth_integration_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Oauth Integration Id",
      description: "OAuth integration ID (required for oauth2 auth_type)",
    },
    custom_credentials: {
      anyOf: [
        {
          type: "string",
          format: "password",
          writeOnly: true,
        },
        {
          type: "null",
        },
      ],
      title: "Custom Credentials",
      description:
        "Custom credentials as JSON headers. Required for custom auth type; optional additional headers for OAuth2 auth type.",
    },
  },
  type: "object",
  required: ["name", "server_uri"],
  title: "MCPHttpIntegrationCreate",
  description: "Request model for creating an HTTP MCP integration.",
} as const

export const $MCPHttpServerConfig = {
  properties: {
    type: {
      type: "string",
      const: "http",
      title: "Type",
    },
    name: {
      type: "string",
      title: "Name",
    },
    url: {
      type: "string",
      title: "Url",
    },
    headers: {
      additionalProperties: {
        type: "string",
      },
      type: "object",
      title: "Headers",
    },
    transport: {
      type: "string",
      enum: ["http", "sse"],
      title: "Transport",
    },
    timeout: {
      type: "integer",
      title: "Timeout",
    },
    id: {
      type: "string",
      title: "Id",
    },
  },
  type: "object",
  required: ["name", "url"],
  title: "MCPHttpServerConfig",
  description: `Configuration for a user-defined MCP server over HTTP/SSE.

Users can connect custom MCP servers to their agents - whether running as
Docker containers, local processes, or remote services. The server must
expose an HTTP or SSE endpoint.

Example:
    {
        "name": "internal-tools",
        "url": "http://host.docker.internal:8080",
        "transport": "http",
        "headers": {"Authorization": "Bearer \${{ SECRETS.internal.API_KEY }}"}
    }`,
} as const

export const $MCPIntegration = {
  properties: {
    component_id: {
      type: "string",
      const: "mcp-integration",
      title: "Component Id",
      default: "mcp-integration",
    },
    multiple: {
      type: "boolean",
      title: "Multiple",
      default: true,
    },
  },
  type: "object",
  title: "MCPIntegration",
} as const

export const $MCPIntegrationCreate = {
  oneOf: [
    {
      $ref: "#/components/schemas/MCPHttpIntegrationCreate",
    },
    {
      $ref: "#/components/schemas/MCPStdioIntegrationCreate",
    },
  ],
} as const

export const $MCPIntegrationRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    slug: {
      type: "string",
      title: "Slug",
    },
    server_type: {
      $ref: "#/components/schemas/MCPServerType",
    },
    server_uri: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Server Uri",
    },
    auth_type: {
      $ref: "#/components/schemas/MCPAuthType",
    },
    oauth_integration_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid4",
        },
        {
          type: "null",
        },
      ],
      title: "Oauth Integration Id",
    },
    stdio_command: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Stdio Command",
    },
    stdio_args: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Stdio Args",
    },
    has_stdio_env: {
      type: "boolean",
      title: "Has Stdio Env",
      default: false,
    },
    timeout: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Timeout",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "name",
    "description",
    "slug",
    "server_type",
    "server_uri",
    "auth_type",
    "oauth_integration_id",
    "stdio_command",
    "stdio_args",
    "timeout",
    "created_at",
    "updated_at",
  ],
  title: "MCPIntegrationRead",
  description: "Response model for MCP integration.",
} as const

export const $MCPIntegrationUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 3,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    server_uri: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Server Uri",
    },
    auth_type: {
      anyOf: [
        {
          $ref: "#/components/schemas/MCPAuthType",
        },
        {
          type: "null",
        },
      ],
    },
    oauth_integration_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Oauth Integration Id",
    },
    custom_credentials: {
      anyOf: [
        {
          type: "string",
          format: "password",
          writeOnly: true,
        },
        {
          type: "null",
        },
      ],
      title: "Custom Credentials",
      description:
        "Custom credentials as JSON headers. Required for custom auth type; optional additional headers for OAuth2 auth type.",
    },
    stdio_command: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Stdio Command",
      description: "Stdio command to run for stdio-type servers (e.g., 'npx')",
    },
    stdio_args: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Stdio Args",
      description: "Arguments for the stdio command",
    },
    stdio_env: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Stdio Env",
      description: "Environment variables for stdio-type servers",
    },
    timeout: {
      anyOf: [
        {
          type: "integer",
          maximum: 300,
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Timeout",
      description: "Timeout in seconds",
    },
  },
  type: "object",
  title: "MCPIntegrationUpdate",
  description: "Request model for updating an MCP integration.",
} as const

export const $MCPPersonalAccessTokenCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Name",
    },
    expires_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Expires At",
    },
  },
  type: "object",
  required: ["name"],
  title: "MCPPersonalAccessTokenCreate",
} as const

export const $MCPPersonalAccessTokenIssueResponse = {
  properties: {
    issued_token: {
      $ref: "#/components/schemas/IssuedMCPPersonalAccessToken",
    },
  },
  type: "object",
  required: ["issued_token"],
  title: "MCPPersonalAccessTokenIssueResponse",
} as const

export const $MCPPersonalAccessTokenRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    key_id: {
      type: "string",
      title: "Key Id",
    },
    preview: {
      type: "string",
      title: "Preview",
    },
    expires_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Expires At",
    },
    last_used_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Used At",
    },
    revoked_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Revoked At",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
    },
    revoked_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Revoked By",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "user_id",
    "organization_id",
    "workspace_id",
    "name",
    "key_id",
    "preview",
    "created_at",
    "updated_at",
  ],
  title: "MCPPersonalAccessTokenRead",
} as const

export const $MCPServerType = {
  type: "string",
  enum: ["http", "stdio"],
} as const

export const $MCPStdioIntegrationCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 3,
      title: "Name",
      description: "MCP integration name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description",
    },
    timeout: {
      anyOf: [
        {
          type: "integer",
          maximum: 300,
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Timeout",
      description: "Timeout in seconds",
      default: 30,
    },
    server_type: {
      type: "string",
      const: "stdio",
      title: "Server Type",
      default: "stdio",
    },
    stdio_command: {
      type: "string",
      maxLength: 500,
      title: "Stdio Command",
      description: "Stdio command to run for stdio-type servers (e.g., 'npx')",
    },
    stdio_args: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Stdio Args",
      description:
        "Arguments for the stdio command (e.g., ['@modelcontextprotocol/server-github'])",
    },
    stdio_env: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Stdio Env",
      description:
        "Environment variables for stdio-type servers (can reference secrets)",
    },
  },
  type: "object",
  required: ["name", "stdio_command"],
  title: "MCPStdioIntegrationCreate",
  description: "Request model for creating a stdio MCP integration.",
} as const

export const $MCPStdioServerConfig = {
  properties: {
    type: {
      type: "string",
      const: "stdio",
      title: "Type",
    },
    name: {
      type: "string",
      title: "Name",
    },
    command: {
      type: "string",
      title: "Command",
    },
    args: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Args",
    },
    env: {
      additionalProperties: {
        type: "string",
      },
      type: "object",
      title: "Env",
    },
    timeout: {
      type: "integer",
      title: "Timeout",
    },
    id: {
      type: "string",
      title: "Id",
    },
  },
  type: "object",
  required: ["type", "name", "command"],
  title: "MCPStdioServerConfig",
  description: "Configuration for a stdio MCP server.",
} as const

export const $MessageKind = {
  type: "string",
  enum: [
    "chat-message",
    "approval-request",
    "approval-decision",
    "internal",
    "compaction",
  ],
  title: "MessageKind",
  description: "The type/kind of message stored in the chat.",
} as const

export const $ModelConfig = {
  properties: {
    name: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Name",
      description:
        "The name of the model. This is used to identify the model in the system.",
    },
    provider: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Provider",
      description:
        "The provider of the model. This is used to determine which organization secret to use for this model.",
    },
    catalog_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Catalog Id",
      description:
        "Optional catalog row backing this model selection. Populated for v2 org-scoped cloud/custom catalog rows; left ``None`` for platform (built-in) models that resolve credentials via ``agent-{provider}-credentials``.",
    },
    org_secret_name: {
      type: "string",
      maxLength: 200,
      minLength: 1,
      title: "Org Secret Name",
      description:
        "The name of the organization secret to use for this model. This secret must be configured in the organization settings.",
    },
    secrets: {
      $ref: "#/components/schemas/ModelSecretConfig",
      description:
        "The secrets to use for this model. This is used to determine which organization secret to use for this model.",
    },
  },
  type: "object",
  required: ["name", "provider", "org_secret_name", "secrets"],
  title: "ModelConfig",
} as const

export const $ModelCredentialCreate = {
  properties: {
    provider: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Provider",
    },
    credentials: {
      additionalProperties: {
        type: "string",
      },
      type: "object",
      title: "Credentials",
      description: "Provider-specific credentials (e.g., api_key)",
    },
  },
  type: "object",
  required: ["provider", "credentials"],
  title: "ModelCredentialCreate",
  description: "Model for creating model credentials.",
} as const

export const $ModelCredentialUpdate = {
  properties: {
    credentials: {
      additionalProperties: {
        type: "string",
      },
      type: "object",
      title: "Credentials",
      description: "Provider-specific credentials to update",
    },
  },
  type: "object",
  required: ["credentials"],
  title: "ModelCredentialUpdate",
  description: "Model for updating model credentials.",
} as const

export const $ModelSecretConfig = {
  properties: {
    required: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Required",
    },
    optional: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Optional",
    },
  },
  type: "object",
  title: "ModelSecretConfig",
} as const

export const $OAuth2AuthorizeResponse = {
  properties: {
    authorization_url: {
      type: "string",
      title: "Authorization Url",
    },
  },
  type: "object",
  required: ["authorization_url"],
  title: "OAuth2AuthorizeResponse",
} as const

export const $OAuthGrantType = {
  type: "string",
  enum: ["authorization_code", "client_credentials"],
  title: "OAuthGrantType",
  description: "Grant type for OAuth 2.0.",
} as const

export const $ObjectRef = {
  properties: {
    backend: {
      type: "string",
      const: "s3",
      title: "Backend",
      default: "s3",
    },
    bucket: {
      type: "string",
      title: "Bucket",
    },
    key: {
      type: "string",
      title: "Key",
    },
    size_bytes: {
      type: "integer",
      title: "Size Bytes",
    },
    sha256: {
      type: "string",
      title: "Sha256",
    },
    content_type: {
      type: "string",
      title: "Content Type",
      default: "application/json",
    },
    encoding: {
      type: "string",
      enum: ["json", "json+zstd", "json+gzip"],
      title: "Encoding",
      default: "json",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
  },
  type: "object",
  required: ["bucket", "key", "size_bytes", "sha256"],
  title: "ObjectRef",
  description: `Reference to an externalized object in blob storage.

This is a typed reference that replaces large payloads in workflow context.
Only dereference ObjectRef instances created by Tracecat - never arbitrary URIs.`,
} as const

export const $OrgCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Name",
    },
    slug: {
      type: "string",
      maxLength: 63,
      minLength: 1,
      pattern: "^[a-z0-9-]+$",
      title: "Slug",
    },
  },
  type: "object",
  required: ["name", "slug"],
  title: "OrgCreate",
  description: "Create organization request.",
} as const

export const $OrgDomainCreate = {
  properties: {
    domain: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Domain",
    },
    is_primary: {
      type: "boolean",
      title: "Is Primary",
      default: false,
    },
  },
  type: "object",
  required: ["domain"],
  title: "OrgDomainCreate",
  description: "Create organization domain request.",
} as const

export const $OrgDomainUpdate = {
  properties: {
    is_primary: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Primary",
    },
    is_active: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Active",
    },
  },
  type: "object",
  title: "OrgDomainUpdate",
  description: "Update organization domain request.",
} as const

export const $OrgInvitationAccept = {
  properties: {
    token: {
      type: "string",
      title: "Token",
    },
  },
  type: "object",
  required: ["token"],
  title: "OrgInvitationAccept",
  description:
    "Request body for accepting an organization invitation via token.",
} as const

export const $OrgInvitationCreate = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
    },
  },
  type: "object",
  required: ["email", "role_id"],
  title: "OrgInvitationCreate",
  description: "Request body for creating an organization invitation.",
} as const

export const $OrgInvitationRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    role_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Role Slug",
    },
    status: {
      $ref: "#/components/schemas/InvitationStatus",
    },
    invited_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Invited By",
    },
    expires_at: {
      type: "string",
      format: "date-time",
      title: "Expires At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    accepted_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Accepted At",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "email",
    "role_id",
    "role_name",
    "status",
    "invited_by",
    "expires_at",
    "created_at",
    "accepted_at",
  ],
  title: "OrgInvitationRead",
  description: "Response model for organization invitation.",
} as const

export const $OrgInvitationReadMinimal = {
  properties: {
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    organization_name: {
      type: "string",
      title: "Organization Name",
    },
    organization_slug: {
      type: "string",
      title: "Organization Slug",
    },
    inviter_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Inviter Name",
    },
    inviter_email: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Inviter Email",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    role_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Role Slug",
    },
    status: {
      $ref: "#/components/schemas/InvitationStatus",
    },
    expires_at: {
      type: "string",
      format: "date-time",
      title: "Expires At",
    },
    email_matches: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Email Matches",
    },
  },
  type: "object",
  required: [
    "organization_id",
    "organization_name",
    "organization_slug",
    "inviter_name",
    "inviter_email",
    "role_name",
    "status",
    "expires_at",
  ],
  title: "OrgInvitationReadMinimal",
  description: `Minimal response for public token-based invitation lookup.

Excludes sensitive fields like email, invited_by ID, and timestamps
to reduce information disclosure when querying by token.`,
} as const

export const $OrgMemberDetail = {
  properties: {
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role: {
      type: "string",
      title: "Role",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
    },
    is_verified: {
      type: "boolean",
      title: "Is Verified",
    },
    last_login_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Login At",
    },
  },
  type: "object",
  required: [
    "user_id",
    "first_name",
    "last_name",
    "email",
    "role",
    "is_active",
    "is_verified",
    "last_login_at",
  ],
  title: "OrgMemberDetail",
  description: "Detailed member info for /me and update endpoints.",
} as const

export const $OrgMemberRead = {
  properties: {
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
    },
    invitation_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Invitation Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    role_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Role Slug",
    },
    status: {
      $ref: "#/components/schemas/OrgMemberStatus",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    last_login_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Login At",
    },
    expires_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Expires At",
    },
    created_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Created At",
    },
  },
  type: "object",
  required: ["email", "role_name", "status"],
  title: "OrgMemberRead",
  description:
    "Unified member representation — covers active, inactive, and pending (invited) members.",
} as const

export const $OrgMemberStatus = {
  type: "string",
  enum: ["active", "inactive", "invited"],
  title: "OrgMemberStatus",
} as const

export const $OrgPendingInvitationRead = {
  properties: {
    token: {
      type: "string",
      title: "Token",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    organization_name: {
      type: "string",
      title: "Organization Name",
    },
    inviter_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Inviter Name",
    },
    inviter_email: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Inviter Email",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    role_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Role Slug",
    },
    expires_at: {
      type: "string",
      format: "date-time",
      title: "Expires At",
    },
  },
  type: "object",
  required: [
    "token",
    "organization_id",
    "organization_name",
    "inviter_name",
    "inviter_email",
    "role_name",
    "expires_at",
  ],
  title: "OrgPendingInvitationRead",
  description: "Pending invitation visible to the invited authenticated user.",
} as const

export const $OrgRegistryRepositoryRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    origin: {
      type: "string",
      title: "Origin",
    },
    last_synced_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Synced At",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
  },
  type: "object",
  required: ["id", "origin"],
  title: "OrgRegistryRepositoryRead",
  description: "Organization registry repository response.",
} as const

export const $OrgRegistrySyncRequest = {
  properties: {
    force: {
      type: "boolean",
      title: "Force",
      description: "Force sync by deleting the existing version first",
      default: false,
    },
  },
  type: "object",
  title: "OrgRegistrySyncRequest",
  description: "Organization registry sync request.",
} as const

export const $OrgRegistrySyncResponse = {
  properties: {
    success: {
      type: "boolean",
      title: "Success",
    },
    repository_id: {
      type: "string",
      format: "uuid",
      title: "Repository Id",
    },
    origin: {
      type: "string",
      title: "Origin",
    },
    version: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Version",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    actions_count: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Actions Count",
    },
    forced: {
      type: "boolean",
      title: "Forced",
      default: false,
    },
    skipped: {
      type: "boolean",
      title: "Skipped",
      default: false,
    },
    message: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Message",
    },
  },
  type: "object",
  required: ["success", "repository_id", "origin"],
  title: "OrgRegistrySyncResponse",
  description: "Organization registry sync response.",
} as const

export const $OrgRegistryVersionPromoteResponse = {
  properties: {
    repository_id: {
      type: "string",
      format: "uuid",
      title: "Repository Id",
    },
    origin: {
      type: "string",
      title: "Origin",
    },
    previous_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Previous Version Id",
    },
    previous_version: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Previous Version",
    },
    current_version_id: {
      type: "string",
      format: "uuid",
      title: "Current Version Id",
    },
    current_version: {
      type: "string",
      title: "Current Version",
    },
  },
  type: "object",
  required: [
    "repository_id",
    "origin",
    "previous_version_id",
    "previous_version",
    "current_version_id",
    "current_version",
  ],
  title: "OrgRegistryVersionPromoteResponse",
  description: "Response from promoting an organization registry version.",
} as const

export const $OrgRegistryVersionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    repository_id: {
      type: "string",
      format: "uuid",
      title: "Repository Id",
    },
    version: {
      type: "string",
      title: "Version",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    tarball_uri: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Tarball Uri",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
  },
  type: "object",
  required: ["id", "repository_id", "version", "created_at"],
  title: "OrgRegistryVersionRead",
  description: "Organization registry version response.",
} as const

export const $OrgUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    slug: {
      anyOf: [
        {
          type: "string",
          maxLength: 63,
          minLength: 1,
          pattern: "^[a-z0-9-]+$",
        },
        {
          type: "null",
        },
      ],
      title: "Slug",
    },
    is_active: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Active",
    },
  },
  type: "object",
  title: "OrgUpdate",
  description: "Update organization request.",
} as const

export const $OrganizationSecretRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    type: {
      $ref: "#/components/schemas/SecretType",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    encrypted_keys: {
      type: "string",
      format: "binary",
      title: "Encrypted Keys",
    },
    environment: {
      type: "string",
      title: "Environment",
    },
    tags: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
  },
  type: "object",
  required: [
    "id",
    "type",
    "name",
    "encrypted_keys",
    "environment",
    "created_at",
    "updated_at",
    "organization_id",
  ],
  title: "OrganizationSecretRead",
  description: "Read schema for organization-scoped secrets.",
} as const

export const $OrganizationTierRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    tier_id: {
      type: "string",
      format: "uuid",
      title: "Tier Id",
    },
    max_concurrent_workflows: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Workflows",
    },
    max_action_executions_per_workflow: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Action Executions Per Workflow",
    },
    max_concurrent_actions: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Actions",
    },
    api_rate_limit: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Rate Limit",
    },
    api_burst_capacity: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Burst Capacity",
    },
    entitlement_overrides: {
      anyOf: [
        {
          $ref: "#/components/schemas/EntitlementsDict",
        },
        {
          type: "null",
        },
      ],
    },
    stripe_customer_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Stripe Customer Id",
    },
    stripe_subscription_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Stripe Subscription Id",
    },
    expires_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Expires At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    tier: {
      anyOf: [
        {
          $ref: "#/components/schemas/TierRead",
        },
        {
          type: "null",
        },
      ],
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "tier_id",
    "max_concurrent_workflows",
    "max_action_executions_per_workflow",
    "max_concurrent_actions",
    "api_rate_limit",
    "api_burst_capacity",
    "entitlement_overrides",
    "stripe_customer_id",
    "stripe_subscription_id",
    "expires_at",
    "created_at",
    "updated_at",
  ],
  title: "OrganizationTierRead",
  description: "Organization tier assignment response.",
} as const

export const $OrganizationTierUpdate = {
  properties: {
    tier_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Tier Id",
    },
    max_concurrent_workflows: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Workflows",
    },
    max_action_executions_per_workflow: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Action Executions Per Workflow",
    },
    max_concurrent_actions: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Actions",
    },
    api_rate_limit: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Rate Limit",
    },
    api_burst_capacity: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Burst Capacity",
    },
    entitlement_overrides: {
      anyOf: [
        {
          $ref: "#/components/schemas/EntitlementsDict",
        },
        {
          type: "null",
        },
      ],
    },
    stripe_customer_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Stripe Customer Id",
    },
    stripe_subscription_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Stripe Subscription Id",
    },
    expires_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Expires At",
    },
  },
  type: "object",
  title: "OrganizationTierUpdate",
  description: "Update organization tier assignment request.",
} as const

export const $OutputType = {
  anyOf: [
    {
      type: "string",
      enum: [
        "bool",
        "float",
        "int",
        "str",
        "list[bool]",
        "list[float]",
        "list[int]",
        "list[str]",
      ],
    },
    {
      additionalProperties: true,
      type: "object",
    },
  ],
} as const

export const $PayloadChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "payload_changed",
      title: "Type",
      default: "payload_changed",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["created_at"],
  title: "PayloadChangedEventRead",
  description: "Event for when a case payload is changed.",
} as const

export const $PlatformRegistrySettingsRead = {
  properties: {
    git_repo_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Url",
    },
    git_repo_package_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Package Name",
    },
    git_allowed_domains: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
          uniqueItems: true,
        },
        {
          type: "null",
        },
      ],
      title: "Git Allowed Domains",
    },
  },
  type: "object",
  title: "PlatformRegistrySettingsRead",
  description: "Platform registry settings response.",
} as const

export const $PlatformRegistrySettingsUpdate = {
  properties: {
    git_repo_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Url",
    },
    git_repo_package_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Package Name",
    },
    git_allowed_domains: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
          uniqueItems: true,
        },
        {
          type: "null",
        },
      ],
      title: "Git Allowed Domains",
    },
  },
  type: "object",
  title: "PlatformRegistrySettingsUpdate",
  description: "Update platform registry settings.",
} as const

export const $Position = {
  properties: {
    x: {
      type: "number",
      title: "X",
      default: 0,
    },
    y: {
      type: "number",
      title: "Y",
      default: 0,
    },
  },
  type: "object",
  title: "Position",
} as const

export const $PriorityChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "priority_changed",
      title: "Type",
      default: "priority_changed",
    },
    old: {
      $ref: "#/components/schemas/CasePriority",
    },
    new: {
      $ref: "#/components/schemas/CasePriority",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["old", "new", "created_at"],
  title: "PriorityChangedEventRead",
  description: "Event for when a case priority is changed.",
} as const

export const $ProviderCredentialConfig = {
  properties: {
    provider: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Provider",
      description: "The provider name",
    },
    label: {
      type: "string",
      maxLength: 200,
      minLength: 1,
      title: "Label",
      description: "Human-readable label for the provider",
    },
    fields: {
      items: {
        $ref: "#/components/schemas/ProviderCredentialField",
      },
      type: "array",
      title: "Fields",
      description: "Required credential fields",
    },
  },
  type: "object",
  required: ["provider", "label", "fields"],
  title: "ProviderCredentialConfig",
  description: "Model for provider credential configuration.",
} as const

export const $ProviderCredentialField = {
  properties: {
    key: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Key",
      description: "The environment variable key for this credential",
    },
    label: {
      type: "string",
      maxLength: 200,
      minLength: 1,
      title: "Label",
      description: "Human-readable label for the field",
    },
    type: {
      type: "string",
      enum: ["text", "password"],
      title: "Type",
      description: "Input type: 'text' or 'password'",
    },
    description: {
      type: "string",
      maxLength: 500,
      minLength: 1,
      title: "Description",
      description: "Help text describing this credential",
    },
    required: {
      type: "boolean",
      title: "Required",
      description: "Whether this field is required",
      default: true,
    },
  },
  type: "object",
  required: ["key", "label", "type", "description"],
  title: "ProviderCredentialField",
  description: "Model for defining credential fields required by a provider.",
} as const

export const $ProviderMetadata = {
  properties: {
    id: {
      type: "string",
      title: "Id",
      description: "Provider identifier",
    },
    name: {
      type: "string",
      title: "Name",
      description: "Human-readable provider name",
    },
    description: {
      type: "string",
      title: "Description",
      description: "Provider description",
    },
    logo_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Logo Url",
      description: "URL to provider logo",
    },
    setup_instructions: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Setup Instructions",
      description: "Setup instructions for the provider",
    },
    requires_config: {
      type: "boolean",
      title: "Requires Config",
      description: "Whether this provider requires additional configuration",
      default: false,
    },
    enabled: {
      type: "boolean",
      title: "Enabled",
      description: "Whether this provider is available for use",
      default: true,
    },
    api_docs_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Api Docs Url",
      description: "URL to API documentation",
    },
    setup_guide_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Setup Guide Url",
      description: "URL to setup guide",
    },
    troubleshooting_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Troubleshooting Url",
      description: "URL to troubleshooting documentation",
    },
  },
  type: "object",
  required: ["id", "name", "description"],
  title: "ProviderMetadata",
  description: "Metadata for a provider.",
} as const

export const $ProviderRead = {
  properties: {
    grant_type: {
      $ref: "#/components/schemas/OAuthGrantType",
    },
    metadata: {
      $ref: "#/components/schemas/ProviderMetadata",
    },
    scopes: {
      $ref: "#/components/schemas/ProviderScopes",
    },
    config_schema: {
      $ref: "#/components/schemas/ProviderSchema",
    },
    integration_status: {
      $ref: "#/components/schemas/IntegrationStatus",
    },
    default_authorization_endpoint: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Default Authorization Endpoint",
    },
    default_token_endpoint: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Default Token Endpoint",
    },
    authorization_endpoint_help: {
      anyOf: [
        {
          type: "string",
        },
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Authorization Endpoint Help",
    },
    token_endpoint_help: {
      anyOf: [
        {
          type: "string",
        },
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Token Endpoint Help",
    },
    redirect_uri: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Redirect Uri",
    },
  },
  type: "object",
  required: [
    "grant_type",
    "metadata",
    "scopes",
    "config_schema",
    "integration_status",
  ],
  title: "ProviderRead",
} as const

export const $ProviderReadMinimal = {
  properties: {
    id: {
      type: "string",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      type: "string",
      title: "Description",
    },
    requires_config: {
      type: "boolean",
      title: "Requires Config",
    },
    integration_status: {
      $ref: "#/components/schemas/IntegrationStatus",
    },
    enabled: {
      type: "boolean",
      title: "Enabled",
    },
    grant_type: {
      $ref: "#/components/schemas/OAuthGrantType",
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "description",
    "requires_config",
    "integration_status",
    "enabled",
    "grant_type",
  ],
  title: "ProviderReadMinimal",
} as const

export const $ProviderSchema = {
  properties: {
    json_schema: {
      additionalProperties: true,
      type: "object",
      title: "Json Schema",
    },
  },
  type: "object",
  required: ["json_schema"],
  title: "ProviderSchema",
  description: "Schema for a provider.",
} as const

export const $ProviderScopes = {
  properties: {
    default: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Default",
      description: "Default scopes for this provider.",
    },
  },
  type: "object",
  required: ["default"],
  title: "ProviderScopes",
  description: "Scope metadata for a provider.",
} as const

export const $PullDiagnostic = {
  properties: {
    workflow_path: {
      type: "string",
      title: "Workflow Path",
    },
    workflow_title: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Title",
    },
    error_type: {
      type: "string",
      enum: [
        "conflict",
        "validation",
        "dependency",
        "parse",
        "github",
        "system",
        "transaction",
      ],
      title: "Error Type",
    },
    message: {
      type: "string",
      title: "Message",
    },
    details: {
      additionalProperties: true,
      type: "object",
      title: "Details",
    },
  },
  type: "object",
  required: [
    "workflow_path",
    "workflow_title",
    "error_type",
    "message",
    "details",
  ],
  title: "PullDiagnostic",
} as const

export const $PullResult = {
  properties: {
    success: {
      type: "boolean",
      title: "Success",
    },
    commit_sha: {
      type: "string",
      title: "Commit Sha",
    },
    workflows_found: {
      type: "integer",
      title: "Workflows Found",
    },
    workflows_imported: {
      type: "integer",
      title: "Workflows Imported",
    },
    diagnostics: {
      items: {
        $ref: "#/components/schemas/PullDiagnostic",
      },
      type: "array",
      title: "Diagnostics",
    },
    message: {
      type: "string",
      title: "Message",
    },
  },
  type: "object",
  required: [
    "success",
    "commit_sha",
    "workflows_found",
    "workflows_imported",
    "diagnostics",
    "message",
  ],
  title: "PullResult",
} as const

export const $RateLimitEvent = {
  properties: {
    rate_limit_info: {
      $ref: "#/components/schemas/RateLimitInfo",
    },
    uuid: {
      type: "string",
      title: "Uuid",
    },
    session_id: {
      type: "string",
      title: "Session Id",
    },
  },
  type: "object",
  required: ["rate_limit_info", "uuid", "session_id"],
  title: "RateLimitEvent",
} as const

export const $RateLimitInfo = {
  properties: {
    status: {
      type: "string",
      enum: ["allowed", "allowed_warning", "rejected"],
      title: "Status",
    },
    resets_at: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Resets At",
    },
    rate_limit_type: {
      anyOf: [
        {
          type: "string",
          enum: [
            "five_hour",
            "seven_day",
            "seven_day_opus",
            "seven_day_sonnet",
            "overage",
          ],
        },
        {
          type: "null",
        },
      ],
      title: "Rate Limit Type",
    },
    utilization: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Utilization",
    },
    overage_status: {
      anyOf: [
        {
          type: "string",
          enum: ["allowed", "allowed_warning", "rejected"],
        },
        {
          type: "null",
        },
      ],
      title: "Overage Status",
    },
    overage_resets_at: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Overage Resets At",
    },
    overage_disabled_reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Overage Disabled Reason",
    },
    raw: {
      additionalProperties: true,
      type: "object",
      title: "Raw",
    },
  },
  type: "object",
  required: ["status"],
  title: "RateLimitInfo",
} as const

export const $ReadinessResponse = {
  properties: {
    status: {
      type: "string",
      title: "Status",
    },
    registry: {
      $ref: "#/components/schemas/RegistryStatus",
    },
  },
  type: "object",
  required: ["status", "registry"],
  title: "ReadinessResponse",
} as const

export const $ReasoningUIPart = {
  properties: {
    type: {
      type: "string",
      const: "reasoning",
      title: "Type",
    },
    text: {
      type: "string",
      title: "Text",
    },
    state: {
      type: "string",
      enum: ["streaming", "done"],
      title: "State",
    },
    providerMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Providermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "text"],
  title: "ReasoningUIPart",
  description: "A reasoning part of a message.",
} as const

export const $ReceiveInteractionResponse = {
  properties: {
    message: {
      type: "string",
      title: "Message",
    },
  },
  type: "object",
  required: ["message"],
  title: "ReceiveInteractionResponse",
} as const

export const $RegistryActionAvailability = {
  properties: {
    locked: {
      type: "boolean",
      title: "Locked",
      description: "Whether this action is locked behind an upgraded plan",
      default: false,
    },
    missing_entitlements: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Missing Entitlements",
      description: "Entitlements required to unlock this action",
    },
  },
  type: "object",
  title: "RegistryActionAvailability",
  description: "Availability metadata for a registry action.",
} as const

export const $RegistryActionInterface = {
  properties: {
    expects: {
      additionalProperties: true,
      type: "object",
      title: "Expects",
    },
    returns: {
      title: "Returns",
    },
  },
  type: "object",
  required: ["expects", "returns"],
  title: "RegistryActionInterface",
} as const

export const $RegistryActionOptions = {
  properties: {
    include_in_schema: {
      type: "boolean",
      title: "Include In Schema",
      default: true,
    },
    requires_approval: {
      type: "boolean",
      title: "Requires Approval",
      default: false,
    },
    required_entitlements: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Required Entitlements",
    },
  },
  type: "object",
  title: "RegistryActionOptions",
} as const

export const $RegistryActionRead = {
  properties: {
    name: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Name",
      description: "The name of the action",
    },
    description: {
      type: "string",
      maxLength: 1000,
      title: "Description",
      description: "The description of the action",
    },
    namespace: {
      type: "string",
      title: "Namespace",
      description: "The namespace of the action",
    },
    type: {
      type: "string",
      enum: ["udf", "template"],
      title: "Type",
      description: "The type of the action",
    },
    origin: {
      type: "string",
      maxLength: 1000,
      minLength: 1,
      title: "Origin",
      description: "The origin of the action as a url",
    },
    secrets: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/RegistrySecretType",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Secrets",
      description: "The secrets required by the action",
    },
    interface: {
      $ref: "#/components/schemas/RegistryActionInterface",
    },
    implementation: {
      oneOf: [
        {
          $ref: "#/components/schemas/RegistryActionTemplateImpl",
        },
        {
          $ref: "#/components/schemas/RegistryActionUDFImpl",
        },
      ],
      title: "Implementation",
      discriminator: {
        propertyName: "type",
        mapping: {
          template: "#/components/schemas/RegistryActionTemplateImpl",
          udf: "#/components/schemas/RegistryActionUDFImpl",
        },
      },
    },
    default_title: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Default Title",
      description: "The default title of the action",
    },
    display_group: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Display Group",
      description: "The presentation group of the action",
    },
    doc_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Doc Url",
      description: "Link to documentation",
    },
    author: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Author",
      description: "Author of the action",
    },
    deprecated: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Deprecated",
      description: "Marks action as deprecated along with message",
    },
    options: {
      $ref: "#/components/schemas/RegistryActionOptions",
      description: "The options for the action",
    },
    repository_id: {
      type: "string",
      format: "uuid4",
      title: "Repository Id",
      description: "The repository id",
    },
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
      description: "The registry action id",
    },
    action: {
      type: "string",
      title: "Action",
      description: "The full action identifier.",
      readOnly: true,
    },
    is_template: {
      type: "boolean",
      title: "Is Template",
      description: "Whether the action is a template.",
      readOnly: true,
    },
  },
  type: "object",
  required: [
    "name",
    "description",
    "namespace",
    "type",
    "origin",
    "interface",
    "implementation",
    "repository_id",
    "id",
    "action",
    "is_template",
  ],
  title: "RegistryActionRead",
  description: "API read model for a registered action.",
} as const

export const $RegistryActionReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
      description: "The registry action id",
    },
    name: {
      type: "string",
      title: "Name",
      description: "The name of the action",
    },
    description: {
      type: "string",
      title: "Description",
      description: "The description of the action",
    },
    namespace: {
      type: "string",
      title: "Namespace",
      description: "The namespace of the action",
    },
    type: {
      type: "string",
      enum: ["udf", "template"],
      title: "Type",
      description: "The type of the action",
    },
    origin: {
      type: "string",
      title: "Origin",
      description: "The origin of the action as a url",
    },
    default_title: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Default Title",
      description: "The default title of the action",
    },
    display_group: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Group",
      description: "The presentation group of the action",
    },
    availability: {
      $ref: "#/components/schemas/RegistryActionAvailability",
      description: "Availability metadata for this action",
    },
    action: {
      type: "string",
      title: "Action",
      description: "The full action identifier.",
      readOnly: true,
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "description",
    "namespace",
    "type",
    "origin",
    "action",
  ],
  title: "RegistryActionReadMinimal",
  description: "API minimal read model for a registered action.",
} as const

export const $RegistryActionTemplateImpl = {
  properties: {
    type: {
      type: "string",
      const: "template",
      title: "Type",
      default: "template",
    },
    template_action: {
      $ref: "#/components/schemas/TemplateAction",
      description: "The template action",
    },
  },
  type: "object",
  required: ["template_action"],
  title: "RegistryActionTemplateImpl",
} as const

export const $RegistryActionUDFImpl = {
  properties: {
    type: {
      type: "string",
      const: "udf",
      title: "Type",
      default: "udf",
    },
    url: {
      type: "string",
      title: "Url",
      description: "The package url",
    },
    module: {
      type: "string",
      title: "Module",
      description: "The module name",
    },
    name: {
      type: "string",
      title: "Name",
      description: "The name of the UDF function name",
    },
  },
  type: "object",
  required: ["url", "module", "name"],
  title: "RegistryActionUDFImpl",
} as const

export const $RegistryActionValidationErrorInfo = {
  properties: {
    type: {
      $ref: "#/components/schemas/TemplateActionValidationErrorType",
    },
    details: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Details",
    },
    is_template: {
      type: "boolean",
      title: "Is Template",
    },
    loc_primary: {
      type: "string",
      title: "Loc Primary",
    },
    loc_secondary: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Loc Secondary",
    },
  },
  type: "object",
  required: ["type", "details", "is_template", "loc_primary"],
  title: "RegistryActionValidationErrorInfo",
} as const

export const $RegistryArtifactsBackfillStartRequest = {
  properties: {
    version_ids: {
      items: {
        type: "string",
        format: "uuid",
      },
      type: "array",
      minItems: 1,
      title: "Version Ids",
    },
  },
  type: "object",
  required: ["version_ids"],
  title: "RegistryArtifactsBackfillStartRequest",
  description:
    "Request to start an artifact backfill workflow for selected versions.",
} as const

export const $RegistryArtifactsBackfillStartResponse = {
  properties: {
    workflow_id: {
      type: "string",
      title: "Workflow Id",
    },
    requested_count: {
      type: "integer",
      title: "Requested Count",
    },
  },
  type: "object",
  required: ["workflow_id", "requested_count"],
  title: "RegistryArtifactsBackfillStartResponse",
  description: "Response after scheduling an artifact backfill workflow.",
} as const

export const $RegistryLock = {
  properties: {
    origins: {
      additionalProperties: {
        type: "string",
      },
      type: "object",
      title: "Origins",
    },
    actions: {
      additionalProperties: {
        type: "string",
      },
      type: "object",
      title: "Actions",
    },
  },
  type: "object",
  required: ["origins", "actions"],
  title: "RegistryLock",
  description: `Registry version lock with action-level bindings for O(1) resolution.

Attributes:
    origins: Maps repository origin to pinned version string.
        Example: {"tracecat_registry": "2024.12.10.123456"}
    actions: Maps action name to its source origin.
        Example: {"core.transform.reshape": "tracecat_registry"}`,
} as const

export const $RegistryOAuthSecret = {
  properties: {
    type: {
      type: "string",
      const: "oauth",
      title: "Type",
      default: "oauth",
    },
    provider_id: {
      type: "string",
      title: "Provider Id",
    },
    grant_type: {
      type: "string",
      enum: ["authorization_code", "client_credentials"],
      title: "Grant Type",
    },
    optional: {
      type: "boolean",
      title: "Optional",
      default: false,
    },
    name: {
      type: "string",
      title: "Name",
      readOnly: true,
    },
  },
  type: "object",
  required: ["provider_id", "grant_type", "name"],
  title: "RegistryOAuthSecret",
  description: "OAuth secret for a provider.",
} as const

export const $RegistryRepositoryCreate = {
  properties: {
    origin: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Origin",
      description: "The origin of the repository",
    },
  },
  type: "object",
  required: ["origin"],
  title: "RegistryRepositoryCreate",
} as const

export const $RegistryRepositoryErrorDetail = {
  properties: {
    id: {
      type: "string",
      title: "Id",
    },
    origin: {
      type: "string",
      title: "Origin",
    },
    message: {
      type: "string",
      title: "Message",
    },
    errors: {
      additionalProperties: {
        items: {
          $ref: "#/components/schemas/RegistryActionValidationErrorInfo",
        },
        type: "array",
      },
      type: "object",
      title: "Errors",
    },
  },
  type: "object",
  required: ["id", "origin", "message", "errors"],
  title: "RegistryRepositoryErrorDetail",
  description: "Error response model for registry sync failures.",
} as const

export const $RegistryRepositoryRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    origin: {
      type: "string",
      title: "Origin",
    },
    last_synced_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Synced At",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
    actions: {
      items: {
        $ref: "#/components/schemas/RegistryActionRead",
      },
      type: "array",
      title: "Actions",
    },
  },
  type: "object",
  required: ["id", "origin", "last_synced_at", "commit_sha", "actions"],
  title: "RegistryRepositoryRead",
} as const

export const $RegistryRepositoryReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    origin: {
      type: "string",
      title: "Origin",
    },
    last_synced_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Synced At",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
  },
  type: "object",
  required: ["id", "origin", "last_synced_at", "commit_sha"],
  title: "RegistryRepositoryReadMinimal",
} as const

export const $RegistryRepositorySync = {
  properties: {
    target_commit_sha: {
      anyOf: [
        {
          type: "string",
          maxLength: 40,
          minLength: 40,
        },
        {
          type: "null",
        },
      ],
      title: "Target Commit Sha",
      description:
        "The specific commit SHA to sync to. If None, syncs to HEAD.",
    },
    force: {
      type: "boolean",
      title: "Force",
      description:
        "Force sync by deleting the existing version first, allowing re-sync.",
      default: false,
    },
  },
  type: "object",
  title: "RegistryRepositorySync",
  description: "Parameters for syncing a repository to a specific commit.",
} as const

export const $RegistryRepositoryUpdate = {
  properties: {
    last_synced_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Synced At",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
      description: "The commit SHA of the repository",
    },
    origin: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Origin",
      description: "The origin of the repository",
    },
  },
  type: "object",
  title: "RegistryRepositoryUpdate",
} as const

export const $RegistrySecret = {
  properties: {
    type: {
      type: "string",
      const: "custom",
      title: "Type",
      default: "custom",
    },
    name: {
      type: "string",
      pattern: "[a-z0-9_]+",
      title: "Name",
    },
    keys: {
      anyOf: [
        {
          items: {
            type: "string",
            pattern: "[a-zA-Z0-9_]+",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Keys",
    },
    optional_keys: {
      anyOf: [
        {
          items: {
            type: "string",
            pattern: "[a-zA-Z0-9_]+",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Optional Keys",
    },
    optional: {
      type: "boolean",
      title: "Optional",
      default: false,
    },
    secret_type: {
      type: "string",
      enum: ["custom", "ssh_key", "mtls", "ca_cert"],
      title: "Secret Type",
      default: "custom",
    },
  },
  type: "object",
  required: ["name"],
  title: "RegistrySecret",
} as const

export const $RegistrySecretType = {
  oneOf: [
    {
      $ref: "#/components/schemas/RegistrySecret",
    },
    {
      $ref: "#/components/schemas/RegistryOAuthSecret",
    },
  ],
  discriminator: {
    propertyName: "type",
    mapping: {
      custom: "#/components/schemas/RegistrySecret",
      oauth: "#/components/schemas/RegistryOAuthSecret",
    },
  },
} as const

export const $RegistryStatus = {
  properties: {
    synced: {
      type: "boolean",
      title: "Synced",
    },
    expected_version: {
      type: "string",
      title: "Expected Version",
    },
    current_version: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version",
    },
  },
  type: "object",
  required: ["synced", "expected_version", "current_version"],
  title: "RegistryStatus",
} as const

export const $RegistryStatusResponse = {
  properties: {
    total_repositories: {
      type: "integer",
      title: "Total Repositories",
    },
    last_sync_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Sync At",
    },
    repositories: {
      items: {
        $ref: "#/components/schemas/RepositoryStatus",
      },
      type: "array",
      title: "Repositories",
    },
  },
  type: "object",
  required: ["total_repositories", "last_sync_at", "repositories"],
  title: "RegistryStatusResponse",
  description: "Registry health status.",
} as const

export const $ReopenedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "case_reopened",
      title: "Type",
      default: "case_reopened",
    },
    old: {
      $ref: "#/components/schemas/CaseStatus",
    },
    new: {
      $ref: "#/components/schemas/CaseStatus",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["old", "new", "created_at"],
  title: "ReopenedEventRead",
  description: "Event for when a case is reopened.",
} as const

export const $RepositoryStatus = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    origin: {
      type: "string",
      title: "Origin",
    },
    last_synced_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Synced At",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
  },
  type: "object",
  required: ["id", "name", "origin", "last_synced_at", "commit_sha"],
  title: "RepositoryStatus",
  description: "Status of a single repository.",
} as const

export const $RepositorySyncResult = {
  properties: {
    repository_id: {
      type: "string",
      format: "uuid",
      title: "Repository Id",
    },
    repository_name: {
      type: "string",
      title: "Repository Name",
    },
    success: {
      type: "boolean",
      title: "Success",
    },
    error: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error",
    },
    version: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Version",
    },
    actions_count: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Actions Count",
    },
  },
  type: "object",
  required: ["repository_id", "repository_name", "success"],
  title: "RepositorySyncResult",
  description: "Result of syncing a single repository.",
} as const

export const $ResolvedAgentsConfig = {
  properties: {
    enabled: {
      type: "boolean",
      title: "Enabled",
      default: false,
    },
    subagents: {
      items: {
        $ref: "#/components/schemas/ResolvedAttachedSubagentRef",
      },
      type: "array",
      title: "Subagents",
    },
  },
  additionalProperties: false,
  type: "object",
  title: "ResolvedAgentsConfig",
  description: "Persisted agents toggle with immutable resolved child refs.",
} as const

export const $ResolvedAttachedSubagentRef = {
  properties: {
    preset: {
      type: "string",
      maxLength: 160,
      minLength: 1,
      title: "Preset",
    },
    preset_version: {
      anyOf: [
        {
          type: "integer",
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Preset Version",
    },
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 80,
          minLength: 1,
          pattern: "^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$",
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    max_turns: {
      anyOf: [
        {
          type: "integer",
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Max Turns",
    },
    preset_id: {
      type: "string",
      format: "uuid",
      title: "Preset Id",
    },
    preset_version_id: {
      type: "string",
      format: "uuid",
      title: "Preset Version Id",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["preset", "preset_id", "preset_version_id"],
  title: "ResolvedAttachedSubagentRef",
  description:
    "Persisted subagent ref with immutable preset/version identifiers.",
} as const

export const $ResponseInteraction = {
  properties: {
    type: {
      type: "string",
      const: "response",
      title: "Type",
    },
    timeout: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Timeout",
      description: "The timeout for the interaction in seconds.",
    },
  },
  type: "object",
  required: ["type"],
  title: "ResponseInteraction",
  description: "Configuration for a response interaction.",
} as const

export const $ResultMessage = {
  properties: {
    subtype: {
      type: "string",
      title: "Subtype",
    },
    duration_ms: {
      type: "integer",
      title: "Duration Ms",
    },
    duration_api_ms: {
      type: "integer",
      title: "Duration Api Ms",
    },
    is_error: {
      type: "boolean",
      title: "Is Error",
    },
    num_turns: {
      type: "integer",
      title: "Num Turns",
    },
    session_id: {
      type: "string",
      title: "Session Id",
    },
    stop_reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Stop Reason",
    },
    total_cost_usd: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Total Cost Usd",
    },
    usage: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Usage",
    },
    result: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Result",
    },
    structured_output: {
      title: "Structured Output",
    },
    model_usage: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Model Usage",
    },
    permission_denials: {
      anyOf: [
        {
          items: {},
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Permission Denials",
    },
    errors: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Errors",
    },
    uuid: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Uuid",
    },
  },
  type: "object",
  required: [
    "subtype",
    "duration_ms",
    "duration_api_ms",
    "is_error",
    "num_turns",
    "session_id",
  ],
  title: "ResultMessage",
} as const

export const $RetryPromptPart = {
  properties: {
    content: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ErrorDetails",
          },
          type: "array",
        },
        {
          type: "string",
        },
      ],
      title: "Content",
    },
    tool_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Tool Name",
    },
    tool_call_id: {
      type: "string",
      title: "Tool Call Id",
    },
    timestamp: {
      type: "string",
      format: "date-time",
      title: "Timestamp",
    },
    part_kind: {
      type: "string",
      const: "retry-prompt",
      title: "Part Kind",
      default: "retry-prompt",
    },
  },
  type: "object",
  required: ["content"],
  title: "RetryPromptPart",
} as const

export const $Role = {
  properties: {
    type: {
      type: "string",
      enum: ["user", "service", "service_account"],
      title: "Type",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
    bound_workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Bound Workspace Id",
    },
    organization_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Organization Id",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
    },
    service_account_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Service Account Id",
    },
    service_id: {
      type: "string",
      enum: [
        "tracecat-api",
        "tracecat-bootstrap",
        "tracecat-cli",
        "tracecat-executor",
        "tracecat-agent-executor",
        "tracecat-case-triggers",
        "tracecat-llm-gateway",
        "tracecat-mcp",
        "tracecat-runner",
        "tracecat-schedule-runner",
        "tracecat-service",
        "tracecat-ui",
      ],
      title: "Service Id",
    },
    is_platform_superuser: {
      type: "boolean",
      title: "Is Platform Superuser",
      default: false,
    },
    scopes: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
          uniqueItems: true,
        },
        {
          type: "null",
        },
      ],
      title: "Scopes",
    },
  },
  additionalProperties: true,
  type: "object",
  required: ["type", "service_id"],
  title: "Role",
  description: `The identity, intrinsic bindings, and resolved authorization context.

User roles
----------
- User roles are authenticated via JWT.
- The \`user_id\` is the user's JWT 'sub' claim.
- User roles do not have an associated \`service_id\`, this must be None.

Service roles
-------------
- Service roles are authenticated via API key.
- Used for internal services to authenticate with the API.
- A service's \`user_id\` is the user it's acting on behalf of. This can be None for internal services.`,
} as const

export const $RoleCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 128,
      minLength: 1,
      title: "Name",
      description: "Role name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description of the role",
    },
    scope_ids: {
      items: {
        type: "string",
        format: "uuid",
      },
      type: "array",
      title: "Scope Ids",
      description: "List of scope IDs to assign to the role",
    },
  },
  type: "object",
  required: ["name"],
  title: "RoleCreate",
  description: "Create schema for a custom role.",
} as const

export const $RoleList = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/RoleReadWithScopes",
      },
      type: "array",
      title: "Items",
    },
    total: {
      type: "integer",
      title: "Total",
    },
  },
  type: "object",
  required: ["items", "total"],
  title: "RoleList",
  description: "Response schema for listing roles.",
} as const

export const $RoleReadWithScopes = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Slug",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
    },
    scopes: {
      items: {
        $ref: "#/components/schemas/ScopeRead",
      },
      type: "array",
      title: "Scopes",
    },
    is_system: {
      type: "boolean",
      title: "Is System",
      description: "Whether this is a preset system role.",
      readOnly: true,
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "organization_id",
    "created_at",
    "updated_at",
    "is_system",
  ],
  title: "RoleReadWithScopes",
  description: "Read schema for a role with its scopes.",
} as const

export const $RoleUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 128,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
      description: "Role name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description of the role",
    },
    scope_ids: {
      anyOf: [
        {
          items: {
            type: "string",
            format: "uuid",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Scope Ids",
      description:
        "List of scope IDs to assign to the role (replaces existing)",
    },
  },
  type: "object",
  title: "RoleUpdate",
  description: "Update schema for a role.",
} as const

export const $RunActionInput = {
  properties: {
    task: {
      $ref: "#/components/schemas/ActionStatement",
    },
    exec_context: {
      $ref: "#/components/schemas/ExecutionContext",
    },
    run_context: {
      $ref: "#/components/schemas/RunContext",
    },
    interaction_context: {
      anyOf: [
        {
          $ref: "#/components/schemas/InteractionContext",
        },
        {
          type: "null",
        },
      ],
    },
    stream_id: {
      type: "string",
      title: "Stream Id",
      default: "<root>:0",
    },
    session_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Session Id",
    },
    registry_lock: {
      $ref: "#/components/schemas/RegistryLock",
    },
  },
  type: "object",
  required: ["task", "exec_context", "run_context", "registry_lock"],
  title: "RunActionInput",
  description:
    "This object contains all the information needed to execute an action.",
} as const

export const $RunContext = {
  properties: {
    wf_id: {
      type: "string",
      title: "Wf Id",
    },
    wf_exec_id: {
      type: "string",
      pattern:
        "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      title: "Wf Exec Id",
    },
    wf_run_id: {
      type: "string",
      format: "uuid4",
      title: "Wf Run Id",
    },
    environment: {
      type: "string",
      title: "Environment",
    },
    logical_time: {
      type: "string",
      format: "date-time",
      title: "Logical Time",
    },
  },
  type: "object",
  required: ["wf_id", "wf_exec_id", "wf_run_id", "environment", "logical_time"],
  title: "RunContext",
  description:
    "This is the runtime context model for a workflow run. Passed into activities.",
} as const

export const $RunUsage = {
  properties: {
    requests: {
      type: "integer",
      title: "Requests",
      default: 0,
    },
    tool_calls: {
      type: "integer",
      title: "Tool Calls",
      default: 0,
    },
    input_tokens: {
      type: "integer",
      title: "Input Tokens",
      default: 0,
    },
    output_tokens: {
      type: "integer",
      title: "Output Tokens",
      default: 0,
    },
  },
  type: "object",
  title: "RunUsage",
  description: "LLM usage associated with an agent run.",
} as const

export const $SAMLDatabaseLoginResponse = {
  properties: {
    redirect_url: {
      type: "string",
      title: "Redirect Url",
    },
  },
  type: "object",
  required: ["redirect_url"],
  title: "SAMLDatabaseLoginResponse",
} as const

export const $SAMLSettingsRead = {
  properties: {
    saml_enabled: {
      type: "boolean",
      title: "Saml Enabled",
    },
    saml_enforced: {
      type: "boolean",
      title: "Saml Enforced",
    },
    saml_idp_metadata_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Saml Idp Metadata Url",
    },
    saml_sp_acs_url: {
      type: "string",
      title: "Saml Sp Acs Url",
    },
    decryption_failed_keys: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Decryption Failed Keys",
      description:
        "Encrypted setting keys that could not be decrypted with the current encryption key and must be reconfigured.",
    },
  },
  type: "object",
  required: ["saml_enabled", "saml_enforced", "saml_sp_acs_url"],
  title: "SAMLSettingsRead",
} as const

export const $SAMLSettingsUpdate = {
  properties: {
    saml_enabled: {
      type: "boolean",
      title: "Saml Enabled",
      description: "Whether SAML is enabled.",
      default: true,
    },
    saml_enforced: {
      type: "boolean",
      title: "Saml Enforced",
      description:
        "Whether SAML is enforced. If true, users can only use SAML to authenticate. Requires SAML to be enabled.",
      default: false,
    },
    saml_idp_metadata_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Saml Idp Metadata Url",
    },
  },
  type: "object",
  title: "SAMLSettingsUpdate",
} as const

export const $ScalarFieldChange = {
  properties: {
    field: {
      type: "string",
      title: "Field",
    },
    old_value: {
      title: "Old Value",
    },
    new_value: {
      title: "New Value",
    },
  },
  type: "object",
  required: ["field"],
  title: "ScalarFieldChange",
  description: "Scalar field change between two preset versions.",
} as const

export const $ScheduleCreate = {
  properties: {
    workflow_id: {
      anyOf: [
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
      ],
      title: "Workflow Id",
    },
    inputs: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Inputs",
    },
    cron: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Cron",
    },
    every: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Every",
      description: "ISO 8601 duration string",
    },
    offset: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Offset",
      description: "ISO 8601 duration string",
    },
    start_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Start At",
      description: "ISO 8601 datetime string",
    },
    end_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "End At",
      description: "ISO 8601 datetime string",
    },
    status: {
      type: "string",
      enum: ["online", "offline"],
      title: "Status",
      default: "online",
    },
    timeout: {
      type: "number",
      title: "Timeout",
      description:
        "The maximum number of seconds to wait for the workflow to complete",
      default: 0,
    },
  },
  type: "object",
  required: ["workflow_id"],
  title: "ScheduleCreate",
} as const

export const $ScheduleRead = {
  properties: {
    id: {
      type: "string",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    workflow_id: {
      type: "string",
      title: "Workflow Id",
    },
    inputs: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Inputs",
    },
    cron: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Cron",
    },
    every: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Every",
    },
    offset: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Offset",
    },
    start_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Start At",
    },
    end_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "End At",
    },
    timeout: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Timeout",
    },
    status: {
      type: "string",
      enum: ["online", "offline"],
      title: "Status",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "created_at",
    "updated_at",
    "workflow_id",
    "status",
  ],
  title: "ScheduleRead",
} as const

export const $ScheduleSearch = {
  properties: {
    workflow_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
    },
    limit: {
      type: "integer",
      title: "Limit",
      default: 100,
    },
    order_by: {
      type: "string",
      title: "Order By",
      default: "created_at",
    },
    query: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Query",
    },
    group_by: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Group By",
    },
    agg: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Agg",
    },
  },
  type: "object",
  title: "ScheduleSearch",
} as const

export const $ScheduleUpdate = {
  properties: {
    inputs: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Inputs",
    },
    cron: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Cron",
    },
    every: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Every",
      description: "ISO 8601 duration string",
    },
    offset: {
      anyOf: [
        {
          type: "string",
          format: "duration",
        },
        {
          type: "null",
        },
      ],
      title: "Offset",
      description: "ISO 8601 duration string",
    },
    start_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Start At",
      description: "ISO 8601 datetime string",
    },
    end_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "End At",
      description: "ISO 8601 datetime string",
    },
    status: {
      anyOf: [
        {
          type: "string",
          enum: ["online", "offline"],
        },
        {
          type: "null",
        },
      ],
      title: "Status",
    },
  },
  type: "object",
  title: "ScheduleUpdate",
} as const

export const $ScopeCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      pattern: "^[a-z0-9:_.*-]+$",
      title: "Name",
      description: "Scope name in format resource:action (e.g., 'custom:read')",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional description of the scope",
    },
  },
  type: "object",
  required: ["name"],
  title: "ScopeCreate",
  description: "Create schema for a custom scope.",
} as const

export const $ScopeList = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/ScopeRead",
      },
      type: "array",
      title: "Items",
    },
    total: {
      type: "integer",
      title: "Total",
    },
  },
  type: "object",
  required: ["items", "total"],
  title: "ScopeList",
  description: "Response schema for listing scopes.",
} as const

export const $ScopeRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    resource: {
      type: "string",
      title: "Resource",
    },
    action: {
      type: "string",
      title: "Action",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    source: {
      $ref: "#/components/schemas/ScopeSource",
    },
    source_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Source Ref",
    },
    organization_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Organization Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "resource",
    "action",
    "source",
    "created_at",
    "updated_at",
  ],
  title: "ScopeRead",
  description: "Read schema for a scope.",
} as const

export const $ScopeSource = {
  type: "string",
  enum: ["platform", "custom"],
  title: "ScopeSource",
  description: "Source/ownership of a scope definition.",
} as const

export const $SecretCreate = {
  properties: {
    type: {
      $ref: "#/components/schemas/SecretType",
      default: "custom",
    },
    name: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
          minLength: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    keys: {
      items: {
        $ref: "#/components/schemas/SecretKeyValue",
      },
      type: "array",
      maxItems: 100,
      minItems: 1,
      title: "Keys",
    },
    tags: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    environment: {
      type: "string",
      title: "Environment",
      default: "default",
    },
  },
  type: "object",
  required: ["name", "keys"],
  title: "SecretCreate",
  description: `Create a new secret.

Secret types
------------
- \`custom\`: Arbitrary user-defined types
- \`token\`: A token, e.g. API Key, JWT Token (TBC)
- \`oauth2\`: OAuth2 Client Credentials (TBC)
- \`mtls\`: TLS client certificate and key
- \`ca_cert\`: Certificate authority bundle`,
} as const

export const $SecretDefinition = {
  properties: {
    name: {
      type: "string",
      title: "Name",
    },
    keys: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Keys",
    },
    optional_keys: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Optional Keys",
    },
    optional: {
      type: "boolean",
      title: "Optional",
      default: false,
    },
    secret_type: {
      $ref: "#/components/schemas/SecretType",
      default: "custom",
    },
    actions: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Actions",
    },
    action_count: {
      type: "integer",
      title: "Action Count",
    },
  },
  type: "object",
  required: ["name", "keys", "actions", "action_count"],
  title: "SecretDefinition",
  description: "Aggregated secret definition from registry actions.",
} as const

export const $SecretKeyValue = {
  properties: {
    key: {
      type: "string",
      title: "Key",
    },
    value: {
      type: "string",
      format: "password",
      title: "Value",
      writeOnly: true,
    },
  },
  type: "object",
  required: ["key", "value"],
  title: "SecretKeyValue",
} as const

export const $SecretRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    type: {
      $ref: "#/components/schemas/SecretType",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    encrypted_keys: {
      type: "string",
      format: "binary",
      title: "Encrypted Keys",
    },
    environment: {
      type: "string",
      title: "Environment",
    },
    tags: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
  },
  type: "object",
  required: [
    "id",
    "type",
    "name",
    "encrypted_keys",
    "environment",
    "created_at",
    "updated_at",
    "workspace_id",
  ],
  title: "SecretRead",
  description: "Read schema for workspace-scoped secrets.",
} as const

export const $SecretReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    type: {
      $ref: "#/components/schemas/SecretType",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    keys: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Keys",
    },
    environment: {
      type: "string",
      title: "Environment",
    },
    is_corrupted: {
      type: "boolean",
      title: "Is Corrupted",
      default: false,
    },
  },
  type: "object",
  required: ["id", "type", "name", "keys", "environment"],
  title: "SecretReadMinimal",
} as const

export const $SecretType = {
  type: "string",
  enum: ["custom", "ssh_key", "mtls", "ca_cert", "github_app"],
  title: "SecretType",
  description: "The type of a secret.",
} as const

export const $SecretUpdate = {
  properties: {
    type: {
      anyOf: [
        {
          $ref: "#/components/schemas/SecretType",
        },
        {
          type: "null",
        },
      ],
    },
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
          minLength: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    keys: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/SecretKeyValue",
          },
          type: "array",
          maxItems: 100,
          minItems: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Keys",
    },
    tags: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
          maxProperties: 1000,
          minProperties: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    environment: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Environment",
    },
  },
  type: "object",
  title: "SecretUpdate",
  description: `Update a secret.

Secret types
------------
- \`custom\`: Arbitrary user-defined types
- \`token\`: A token, e.g. API Key, JWT Token (TBC)
- \`oauth2\`: OAuth2 Client Credentials (TBC)
- \`mtls\`: TLS client certificate and key
- \`ca_cert\`: Certificate authority bundle`,
} as const

export const $SecretValidationDetail = {
  properties: {
    environment: {
      type: "string",
      title: "Environment",
    },
    secret_name: {
      type: "string",
      title: "Secret Name",
    },
  },
  type: "object",
  required: ["environment", "secret_name"],
  title: "SecretValidationDetail",
  description: "Detail of a secret validation result.",
} as const

export const $SecretValidationResult = {
  properties: {
    type: {
      type: "string",
      const: "secret",
      title: "Type",
      default: "secret",
    },
    status: {
      type: "string",
      enum: ["success", "error"],
      title: "Status",
    },
    msg: {
      type: "string",
      title: "Msg",
      default: "",
    },
    detail: {
      anyOf: [
        {
          $ref: "#/components/schemas/SecretValidationDetail",
        },
        {
          type: "null",
        },
      ],
    },
    ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
    },
  },
  type: "object",
  required: ["status"],
  title: "SecretValidationResult",
  description: "Result of validating credentials.",
} as const

export const $Select = {
  properties: {
    component_id: {
      type: "string",
      const: "select",
      title: "Component Id",
      default: "select",
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
    multiple: {
      type: "boolean",
      title: "Multiple",
      default: false,
    },
  },
  type: "object",
  title: "Select",
} as const

export const $ServiceAccountApiKeyCounts = {
  properties: {
    total: {
      type: "integer",
      title: "Total",
      default: 0,
    },
    active: {
      type: "integer",
      title: "Active",
      default: 0,
    },
    revoked: {
      type: "integer",
      title: "Revoked",
      default: 0,
    },
  },
  type: "object",
  title: "ServiceAccountApiKeyCounts",
} as const

export const $ServiceAccountApiKeyCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Name",
      default: "Primary",
    },
  },
  type: "object",
  title: "ServiceAccountApiKeyCreate",
} as const

export const $ServiceAccountApiKeyIssueResponse = {
  properties: {
    issued_api_key: {
      $ref: "#/components/schemas/IssuedServiceAccountApiKey",
    },
    service_account: {
      $ref: "#/components/schemas/ServiceAccountRead",
    },
  },
  type: "object",
  required: ["issued_api_key", "service_account"],
  title: "ServiceAccountApiKeyIssueResponse",
} as const

export const $ServiceAccountApiKeyRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    key_id: {
      type: "string",
      title: "Key Id",
    },
    preview: {
      type: "string",
      title: "Preview",
    },
    created_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Created By",
    },
    created_by_user: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserReadMinimal",
        },
        {
          type: "null",
        },
      ],
    },
    revoked_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Revoked By",
    },
    revoked_by_user: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserReadMinimal",
        },
        {
          type: "null",
        },
      ],
    },
    last_used_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Used At",
    },
    revoked_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Revoked At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: ["id", "name", "key_id", "preview", "created_at", "updated_at"],
  title: "ServiceAccountApiKeyRead",
} as const

export const $ServiceAccountCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    scope_ids: {
      items: {
        type: "string",
        format: "uuid",
      },
      type: "array",
      title: "Scope Ids",
    },
    initial_key_name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Initial Key Name",
      default: "Primary",
    },
  },
  type: "object",
  required: ["name"],
  title: "ServiceAccountCreate",
} as const

export const $ServiceAccountRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
    owner_user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Owner User Id",
    },
    owner_user: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserReadMinimal",
        },
        {
          type: "null",
        },
      ],
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    disabled_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Disabled At",
    },
    last_used_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Used At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    scopes: {
      items: {
        $ref: "#/components/schemas/ServiceAccountScopeRead",
      },
      type: "array",
      title: "Scopes",
    },
    active_api_key: {
      anyOf: [
        {
          $ref: "#/components/schemas/ServiceAccountApiKeyRead",
        },
        {
          type: "null",
        },
      ],
    },
    api_key_counts: {
      $ref: "#/components/schemas/ServiceAccountApiKeyCounts",
    },
  },
  type: "object",
  required: ["id", "organization_id", "name", "created_at", "updated_at"],
  title: "ServiceAccountRead",
} as const

export const $ServiceAccountScopeList = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/ServiceAccountScopeRead",
      },
      type: "array",
      title: "Items",
    },
  },
  type: "object",
  title: "ServiceAccountScopeList",
} as const

export const $ServiceAccountScopeRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    resource: {
      type: "string",
      title: "Resource",
    },
    action: {
      type: "string",
      title: "Action",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
  },
  type: "object",
  required: ["id", "name", "resource", "action"],
  title: "ServiceAccountScopeRead",
} as const

export const $ServiceAccountUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 512,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    scope_ids: {
      anyOf: [
        {
          items: {
            type: "string",
            format: "uuid",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Scope Ids",
    },
  },
  type: "object",
  title: "ServiceAccountUpdate",
} as const

export const $SessionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid4",
      title: "Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    user_id: {
      type: "string",
      format: "uuid4",
      title: "User Id",
    },
    user_email: {
      type: "string",
      format: "email",
      title: "User Email",
    },
  },
  type: "object",
  required: ["id", "created_at", "user_id", "user_email"],
  title: "SessionRead",
} as const

export const $Session_Any_ = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    events: {
      anyOf: [
        {
          items: {},
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Events",
      description: "The events in the session.",
    },
  },
  type: "object",
  required: ["id"],
  title: "Session[Any]",
} as const

export const $SeverityChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "severity_changed",
      title: "Type",
      default: "severity_changed",
    },
    old: {
      $ref: "#/components/schemas/CaseSeverity",
    },
    new: {
      $ref: "#/components/schemas/CaseSeverity",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["old", "new", "created_at"],
  title: "SeverityChangedEventRead",
  description: "Event for when a case severity is changed.",
} as const

export const $SkillCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 64,
      minLength: 1,
      pattern: "^[a-z0-9-]+$",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 4000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
  },
  type: "object",
  required: ["name"],
  title: "SkillCreate",
  description: "Payload for creating a new logical skill.",
} as const

export const $SkillDraftAttachUploadedBlobOp = {
  properties: {
    op: {
      type: "string",
      const: "attach_uploaded_blob",
      title: "Op",
      default: "attach_uploaded_blob",
    },
    path: {
      type: "string",
      maxLength: 1024,
      minLength: 1,
      title: "Path",
    },
    upload_id: {
      type: "string",
      format: "uuid",
      title: "Upload Id",
    },
  },
  type: "object",
  required: ["path", "upload_id"],
  title: "SkillDraftAttachUploadedBlobOp",
  description: "Attach a finalized staged upload to a draft path.",
} as const

export const $SkillDraftDeleteFileOp = {
  properties: {
    op: {
      type: "string",
      const: "delete_file",
      title: "Op",
      default: "delete_file",
    },
    path: {
      type: "string",
      maxLength: 1024,
      minLength: 1,
      title: "Path",
    },
  },
  type: "object",
  required: ["path"],
  title: "SkillDraftDeleteFileOp",
  description: "Delete a file from the mutable skill draft.",
} as const

export const $SkillDraftFileRead = {
  properties: {
    kind: {
      type: "string",
      enum: ["inline", "download"],
      title: "Kind",
    },
    path: {
      type: "string",
      title: "Path",
    },
    content_type: {
      type: "string",
      title: "Content Type",
    },
    size_bytes: {
      type: "integer",
      title: "Size Bytes",
    },
    sha256: {
      type: "string",
      title: "Sha256",
    },
    text_content: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Text Content",
    },
    download_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Download Url",
    },
  },
  type: "object",
  required: ["kind", "path", "content_type", "size_bytes", "sha256"],
  title: "SkillDraftFileRead",
  description: "Response model for reading a single skill draft file.",
} as const

export const $SkillDraftMoveFileOp = {
  properties: {
    op: {
      type: "string",
      const: "move_file",
      title: "Op",
      default: "move_file",
    },
    from_path: {
      type: "string",
      maxLength: 1024,
      minLength: 1,
      title: "From Path",
    },
    to_path: {
      type: "string",
      maxLength: 1024,
      minLength: 1,
      title: "To Path",
    },
  },
  type: "object",
  required: ["from_path", "to_path"],
  title: "SkillDraftMoveFileOp",
  description:
    "Move (rename) a draft file to a new path while preserving its blob.",
} as const

export const $SkillDraftOperation = {
  oneOf: [
    {
      $ref: "#/components/schemas/SkillDraftUpsertTextFileOp",
    },
    {
      $ref: "#/components/schemas/SkillDraftAttachUploadedBlobOp",
    },
    {
      $ref: "#/components/schemas/SkillDraftDeleteFileOp",
    },
    {
      $ref: "#/components/schemas/SkillDraftMoveFileOp",
    },
  ],
  discriminator: {
    propertyName: "op",
    mapping: {
      attach_uploaded_blob:
        "#/components/schemas/SkillDraftAttachUploadedBlobOp",
      delete_file: "#/components/schemas/SkillDraftDeleteFileOp",
      move_file: "#/components/schemas/SkillDraftMoveFileOp",
      upsert_text_file: "#/components/schemas/SkillDraftUpsertTextFileOp",
    },
  },
} as const

export const $SkillDraftPatch = {
  properties: {
    base_revision: {
      type: "integer",
      minimum: 0,
      title: "Base Revision",
    },
    operations: {
      items: {
        $ref: "#/components/schemas/SkillDraftOperation",
      },
      type: "array",
      minItems: 1,
      title: "Operations",
    },
  },
  type: "object",
  required: ["base_revision", "operations"],
  title: "SkillDraftPatch",
  description: "Optimistic-concurrency draft mutation request.",
} as const

export const $SkillDraftRead = {
  properties: {
    skill_id: {
      type: "string",
      format: "uuid",
      title: "Skill Id",
    },
    skill_name: {
      type: "string",
      title: "Skill Name",
    },
    draft_revision: {
      type: "integer",
      title: "Draft Revision",
    },
    name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    files: {
      items: {
        $ref: "#/components/schemas/SkillFileEntry",
      },
      type: "array",
      title: "Files",
    },
    is_publishable: {
      type: "boolean",
      title: "Is Publishable",
    },
    validation_errors: {
      items: {
        $ref: "#/components/schemas/SkillValidationErrorDetail",
      },
      type: "array",
      title: "Validation Errors",
    },
  },
  type: "object",
  required: ["skill_id", "skill_name", "draft_revision", "is_publishable"],
  title: "SkillDraftRead",
  description: "Current mutable draft state for a skill.",
} as const

export const $SkillDraftUpsertTextFileOp = {
  properties: {
    op: {
      type: "string",
      const: "upsert_text_file",
      title: "Op",
      default: "upsert_text_file",
    },
    path: {
      type: "string",
      maxLength: 1024,
      minLength: 1,
      title: "Path",
    },
    content: {
      type: "string",
      title: "Content",
    },
    content_type: {
      type: "string",
      maxLength: 255,
      title: "Content Type",
      default: "text/plain; charset=utf-8",
    },
  },
  type: "object",
  required: ["path", "content"],
  title: "SkillDraftUpsertTextFileOp",
  description: "Replace or create a text file in the skill draft.",
} as const

export const $SkillFileEntry = {
  properties: {
    path: {
      type: "string",
      title: "Path",
    },
    blob_id: {
      type: "string",
      format: "uuid",
      title: "Blob Id",
    },
    sha256: {
      type: "string",
      title: "Sha256",
    },
    size_bytes: {
      type: "integer",
      title: "Size Bytes",
    },
    content_type: {
      type: "string",
      title: "Content Type",
    },
  },
  type: "object",
  required: ["path", "blob_id", "sha256", "size_bytes", "content_type"],
  title: "SkillFileEntry",
  description:
    "Manifest entry for a skill file (used in both drafts and versions).",
} as const

export const $SkillRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
    draft_revision: {
      type: "integer",
      title: "Draft Revision",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    archived_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Archived At",
    },
    current_version: {
      anyOf: [
        {
          $ref: "#/components/schemas/SkillVersionReadMinimal",
        },
        {
          type: "null",
        },
      ],
    },
    is_draft_publishable: {
      type: "boolean",
      title: "Is Draft Publishable",
    },
    draft_validation_errors: {
      items: {
        $ref: "#/components/schemas/SkillValidationErrorDetail",
      },
      type: "array",
      title: "Draft Validation Errors",
    },
    draft_file_count: {
      type: "integer",
      title: "Draft File Count",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "name",
    "draft_revision",
    "created_at",
    "updated_at",
    "is_draft_publishable",
    "draft_file_count",
  ],
  title: "SkillRead",
  description: "Full response model for a workspace skill.",
} as const

export const $SkillReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    current_version_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Current Version Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    archived_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Archived At",
    },
  },
  type: "object",
  required: ["id", "workspace_id", "name", "created_at", "updated_at"],
  title: "SkillReadMinimal",
  description: "Minimal response model for listing workspace skills.",
} as const

export const $SkillUpload = {
  properties: {
    name: {
      type: "string",
      maxLength: 64,
      minLength: 1,
      pattern: "^[a-z0-9-]+$",
      title: "Name",
    },
    files: {
      items: {
        $ref: "#/components/schemas/SkillUploadFile",
      },
      type: "array",
      minItems: 1,
      title: "Files",
    },
  },
  type: "object",
  required: ["name", "files"],
  title: "SkillUpload",
  description: "Payload for importing a full skill draft in one request.",
} as const

export const $SkillUploadFile = {
  properties: {
    path: {
      type: "string",
      maxLength: 1024,
      minLength: 1,
      title: "Path",
    },
    content_base64: {
      type: "string",
      title: "Content Base64",
    },
    content_type: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
        },
        {
          type: "null",
        },
      ],
      title: "Content Type",
    },
  },
  type: "object",
  required: ["path", "content_base64"],
  title: "SkillUploadFile",
  description: "Single file in a one-shot skill upload payload.",
} as const

export const $SkillUploadSessionCreate = {
  properties: {
    sha256: {
      type: "string",
      maxLength: 64,
      minLength: 64,
      pattern: "^[0-9a-fA-F]{64}$",
      title: "Sha256",
    },
    size_bytes: {
      type: "integer",
      exclusiveMinimum: 0,
      title: "Size Bytes",
    },
    content_type: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Content Type",
    },
  },
  type: "object",
  required: ["sha256", "size_bytes", "content_type"],
  title: "SkillUploadSessionCreate",
  description: "Request body for creating a staged draft upload.",
} as const

export const $SkillUploadSessionRead = {
  properties: {
    upload_id: {
      type: "string",
      format: "uuid",
      title: "Upload Id",
    },
    upload_url: {
      type: "string",
      title: "Upload Url",
    },
    method: {
      type: "string",
      const: "PUT",
      title: "Method",
      default: "PUT",
    },
    headers: {
      additionalProperties: {
        type: "string",
      },
      type: "object",
      title: "Headers",
    },
    expires_at: {
      type: "string",
      format: "date-time",
      title: "Expires At",
    },
    bucket: {
      type: "string",
      title: "Bucket",
    },
    key: {
      type: "string",
      title: "Key",
    },
  },
  type: "object",
  required: ["upload_id", "upload_url", "expires_at", "bucket", "key"],
  title: "SkillUploadSessionRead",
  description: "Presigned upload session details for a draft file blob.",
} as const

export const $SkillValidationErrorDetail = {
  properties: {
    code: {
      type: "string",
      title: "Code",
    },
    message: {
      type: "string",
      title: "Message",
    },
    path: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Path",
    },
  },
  type: "object",
  required: ["code", "message"],
  title: "SkillValidationErrorDetail",
  description: "Structured draft validation error.",
} as const

export const $SkillVersionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    skill_id: {
      type: "string",
      format: "uuid",
      title: "Skill Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    version: {
      type: "integer",
      title: "Version",
    },
    manifest_sha256: {
      type: "string",
      title: "Manifest Sha256",
    },
    file_count: {
      type: "integer",
      title: "File Count",
    },
    total_size_bytes: {
      type: "integer",
      title: "Total Size Bytes",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    files: {
      items: {
        $ref: "#/components/schemas/SkillFileEntry",
      },
      type: "array",
      title: "Files",
    },
  },
  type: "object",
  required: [
    "id",
    "skill_id",
    "workspace_id",
    "version",
    "manifest_sha256",
    "file_count",
    "total_size_bytes",
    "name",
    "created_at",
    "updated_at",
  ],
  title: "SkillVersionRead",
  description: "Published skill version response including its manifest.",
} as const

export const $SkillVersionReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    skill_id: {
      type: "string",
      format: "uuid",
      title: "Skill Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    version: {
      type: "integer",
      title: "Version",
    },
    manifest_sha256: {
      type: "string",
      title: "Manifest Sha256",
    },
    file_count: {
      type: "integer",
      title: "File Count",
    },
    total_size_bytes: {
      type: "integer",
      title: "Total Size Bytes",
    },
    name: {
      type: "string",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "skill_id",
    "workspace_id",
    "version",
    "manifest_sha256",
    "file_count",
    "total_size_bytes",
    "name",
    "created_at",
    "updated_at",
  ],
  title: "SkillVersionReadMinimal",
  description:
    "Summary response model for published skill versions in list endpoints.",
} as const

export const $SlackChannelTokenConfig = {
  properties: {
    slack_bot_token: {
      type: "string",
      minLength: 1,
      title: "Slack Bot Token",
      description: "Slack bot token used for API calls",
    },
    slack_client_id: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Slack Client Id",
      description: "Slack app client ID used for OAuth install",
    },
    slack_client_secret: {
      anyOf: [
        {
          type: "string",
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Slack Client Secret",
      description: "Slack app client secret used for OAuth install",
    },
    slack_signing_secret: {
      type: "string",
      minLength: 1,
      title: "Slack Signing Secret",
      description: "Slack signing secret used for request verification",
    },
  },
  type: "object",
  required: ["slack_bot_token", "slack_signing_secret"],
  title: "SlackChannelTokenConfig",
  description: "Slack channel token configuration.",
} as const

export const $SlackOAuthStartRequest = {
  properties: {
    token_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Token Id",
      description: "Existing channel token ID. If omitted, creates one.",
    },
    agent_preset_id: {
      type: "string",
      format: "uuid",
      title: "Agent Preset Id",
      description: "Agent preset to associate with the channel token.",
    },
    client_id: {
      type: "string",
      minLength: 1,
      title: "Client Id",
      description: "Slack app client ID",
    },
    client_secret: {
      type: "string",
      minLength: 1,
      title: "Client Secret",
      description: "Slack app client secret",
    },
    signing_secret: {
      type: "string",
      minLength: 1,
      title: "Signing Secret",
      description: "Slack app signing secret",
    },
    return_url: {
      type: "string",
      minLength: 1,
      title: "Return Url",
      description: "URL to return users to after OAuth callback",
    },
  },
  type: "object",
  required: [
    "agent_preset_id",
    "client_id",
    "client_secret",
    "signing_secret",
    "return_url",
  ],
  title: "SlackOAuthStartRequest",
  description: "Request schema for starting Slack OAuth install flow.",
} as const

export const $SlackOAuthStartResponse = {
  properties: {
    authorization_url: {
      type: "string",
      title: "Authorization Url",
    },
    token: {
      $ref: "#/components/schemas/AgentChannelTokenRead",
    },
  },
  type: "object",
  required: ["authorization_url", "token"],
  title: "SlackOAuthStartResponse",
  description: "Response schema for Slack OAuth start.",
} as const

export const $SourceDocumentUIPart = {
  properties: {
    type: {
      type: "string",
      const: "source-document",
      title: "Type",
    },
    sourceId: {
      type: "string",
      title: "Sourceid",
    },
    mediaType: {
      type: "string",
      title: "Mediatype",
    },
    title: {
      type: "string",
      title: "Title",
    },
    filename: {
      type: "string",
      title: "Filename",
    },
    providerMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Providermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "sourceId", "mediaType", "title"],
  title: "SourceDocumentUIPart",
  description: "A document source part of a message.",
} as const

export const $SourceUrlUIPart = {
  properties: {
    type: {
      type: "string",
      const: "source-url",
      title: "Type",
    },
    sourceId: {
      type: "string",
      title: "Sourceid",
    },
    url: {
      type: "string",
      title: "Url",
    },
    title: {
      type: "string",
      title: "Title",
    },
    providerMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Providermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "sourceId", "url"],
  title: "SourceUrlUIPart",
  description: "A source URL part of a message.",
} as const

export const $SpecialUserID = {
  type: "string",
  enum: ["current"],
  title: "SpecialUserID",
  description: "A sentinel user ID that represents the current user.",
} as const

export const $SqlType = {
  type: "string",
  enum: [
    "TEXT",
    "INTEGER",
    "NUMERIC",
    "DATE",
    "BOOLEAN",
    "TIMESTAMPTZ",
    "JSONB",
    "SELECT",
    "MULTI_SELECT",
  ],
  title: "SqlType",
  description: "Supported SQL types.",
} as const

export const $StatusChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "status_changed",
      title: "Type",
      default: "status_changed",
    },
    old: {
      $ref: "#/components/schemas/CaseStatus",
    },
    new: {
      $ref: "#/components/schemas/CaseStatus",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["old", "new", "created_at"],
  title: "StatusChangedEventRead",
  description: "Event for when a case status is changed.",
} as const

export const $StepStartUIPart = {
  properties: {
    type: {
      type: "string",
      const: "step-start",
      title: "Type",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type"],
  title: "StepStartUIPart",
  description: "A step boundary part of a message.",
} as const

export const $StreamEvent = {
  properties: {
    uuid: {
      type: "string",
      title: "Uuid",
    },
    session_id: {
      type: "string",
      title: "Session Id",
    },
    event: {
      additionalProperties: true,
      type: "object",
      title: "Event",
    },
    parent_tool_use_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Tool Use Id",
    },
  },
  type: "object",
  required: ["uuid", "session_id", "event"],
  title: "StreamEvent",
} as const

export const $StringListFieldChange = {
  properties: {
    field: {
      type: "string",
      title: "Field",
    },
    added: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Added",
    },
    removed: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Removed",
    },
  },
  type: "object",
  required: ["field"],
  title: "StringListFieldChange",
  description: "List diff for preset version fields.",
} as const

export const $SyntaxToken = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    value: {
      type: "string",
      title: "Value",
    },
    start: {
      type: "integer",
      title: "Start",
    },
    end: {
      type: "integer",
      title: "End",
    },
  },
  type: "object",
  required: ["type", "value", "start", "end"],
  title: "SyntaxToken",
} as const

export const $SystemMessage = {
  properties: {
    subtype: {
      type: "string",
      title: "Subtype",
    },
    data: {
      additionalProperties: true,
      type: "object",
      title: "Data",
    },
  },
  type: "object",
  required: ["subtype", "data"],
  title: "SystemMessage",
} as const

export const $TableColumnCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Name",
      description: "The name of the column",
    },
    type: {
      $ref: "#/components/schemas/SqlType",
      maxLength: 100,
      minLength: 1,
      description: "The SQL type of the column",
    },
    nullable: {
      type: "boolean",
      title: "Nullable",
      default: true,
    },
    default: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Default",
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
  },
  type: "object",
  required: ["name", "type"],
  title: "TableColumnCreate",
  description: "Create model for a table column.",
} as const

export const $TableColumnRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    type: {
      $ref: "#/components/schemas/SqlType",
    },
    nullable: {
      type: "boolean",
      title: "Nullable",
      default: true,
    },
    default: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Default",
    },
    is_index: {
      type: "boolean",
      title: "Is Index",
      default: false,
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
  },
  type: "object",
  required: ["id", "name", "type"],
  title: "TableColumnRead",
  description: "Definition for a table column.",
} as const

export const $TableColumnUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
      description: "The name of the column",
    },
    type: {
      anyOf: [
        {
          $ref: "#/components/schemas/SqlType",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      description: "The SQL type of the column",
    },
    nullable: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Nullable",
      description: "Whether the column can be null",
    },
    default: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Default",
      description: "The default value of the column",
    },
    is_index: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Index",
      description:
        "True creates a unique index, False drops it, None leaves unchanged.",
    },
    options: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Options",
    },
  },
  type: "object",
  title: "TableColumnUpdate",
  description: "Update model for a table column.",
} as const

export const $TableCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Name",
      description: "The name of the table",
    },
    columns: {
      items: {
        $ref: "#/components/schemas/TableColumnCreate",
      },
      type: "array",
      title: "Columns",
      description: "The columns of the table",
    },
  },
  type: "object",
  required: ["name"],
  title: "TableCreate",
  description: "Create model for a table.",
} as const

export const $TableImportResponse = {
  properties: {
    table: {
      $ref: "#/components/schemas/TableRead",
    },
    rows_inserted: {
      type: "integer",
      title: "Rows Inserted",
    },
    column_mapping: {
      items: {
        $ref: "#/components/schemas/InferredColumn",
      },
      type: "array",
      title: "Column Mapping",
    },
  },
  type: "object",
  required: ["table", "rows_inserted", "column_mapping"],
  title: "TableImportResponse",
  description: "Response model for importing a table from CSV.",
} as const

export const $TableRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    columns: {
      items: {
        $ref: "#/components/schemas/TableColumnRead",
      },
      type: "array",
      title: "Columns",
    },
  },
  type: "object",
  required: ["id", "name", "columns"],
  title: "TableRead",
  description: "Read model for a table.",
} as const

export const $TableReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: ["id", "name", "created_at", "updated_at"],
  title: "TableReadMinimal",
  description: "Read model for a table.",
} as const

export const $TableRowBatchDelete = {
  properties: {
    row_ids: {
      items: {
        type: "string",
        format: "uuid",
      },
      type: "array",
      maxItems: 1000,
      minItems: 1,
      title: "Row Ids",
    },
  },
  type: "object",
  required: ["row_ids"],
  title: "TableRowBatchDelete",
  description: "Request body for batch deleting rows.",
} as const

export const $TableRowBatchDeleteResponse = {
  properties: {
    rows_deleted: {
      type: "integer",
      title: "Rows Deleted",
    },
  },
  type: "object",
  required: ["rows_deleted"],
  title: "TableRowBatchDeleteResponse",
  description: "Response for batch delete operation.",
} as const

export const $TableRowBatchUpdate = {
  properties: {
    row_ids: {
      items: {
        type: "string",
        format: "uuid",
      },
      type: "array",
      maxItems: 1000,
      minItems: 1,
      title: "Row Ids",
    },
    data: {
      additionalProperties: true,
      type: "object",
      minProperties: 1,
      title: "Data",
    },
  },
  type: "object",
  required: ["row_ids", "data"],
  title: "TableRowBatchUpdate",
  description: "Request body for batch updating rows.",
} as const

export const $TableRowBatchUpdateResponse = {
  properties: {
    rows_updated: {
      type: "integer",
      title: "Rows Updated",
    },
  },
  type: "object",
  required: ["rows_updated"],
  title: "TableRowBatchUpdateResponse",
  description: "Response for batch update operation.",
} as const

export const $TableRowInsert = {
  properties: {
    data: {
      additionalProperties: true,
      type: "object",
      title: "Data",
    },
    upsert: {
      type: "boolean",
      title: "Upsert",
      default: false,
    },
  },
  type: "object",
  required: ["data"],
  title: "TableRowInsert",
  description: "Insert model for a table row.",
} as const

export const $TableRowInsertBatch = {
  properties: {
    rows: {
      items: {
        additionalProperties: true,
        type: "object",
      },
      type: "array",
      title: "Rows",
    },
    upsert: {
      type: "boolean",
      title: "Upsert",
      default: false,
    },
  },
  type: "object",
  required: ["rows"],
  title: "TableRowInsertBatch",
  description: "Request body for batch inserting rows.",
} as const

export const $TableRowInsertBatchResponse = {
  properties: {
    rows_inserted: {
      type: "integer",
      title: "Rows Inserted",
    },
  },
  type: "object",
  required: ["rows_inserted"],
  title: "TableRowInsertBatchResponse",
  description: "Response for batch insert operation.",
} as const

export const $TableRowLinkedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "table_row_linked",
      title: "Type",
      default: "table_row_linked",
    },
    table_id: {
      type: "string",
      format: "uuid",
      title: "Table Id",
    },
    table_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Table Name",
    },
    row_id: {
      type: "string",
      format: "uuid",
      title: "Row Id",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["table_id", "row_id", "created_at"],
  title: "TableRowLinkedEventRead",
  description: "Event for when a table row is linked to a case.",
} as const

export const $TableRowRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  additionalProperties: true,
  type: "object",
  required: ["id", "created_at", "updated_at"],
  title: "TableRowRead",
  description: "Read model for a table row.",
} as const

export const $TableRowUnlinkedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "table_row_unlinked",
      title: "Type",
      default: "table_row_unlinked",
    },
    table_id: {
      type: "string",
      format: "uuid",
      title: "Table Id",
    },
    table_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Table Name",
    },
    row_id: {
      type: "string",
      format: "uuid",
      title: "Row Id",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["table_id", "row_id", "created_at"],
  title: "TableRowUnlinkedEventRead",
  description: "Event for when a table row is unlinked from a case.",
} as const

export const $TableRowUpdate = {
  properties: {
    data: {
      additionalProperties: true,
      type: "object",
      title: "Data",
    },
  },
  type: "object",
  required: ["data"],
  title: "TableRowUpdate",
  description: "Update model for a table row.",
} as const

export const $TableUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
      description: "The name of the table",
    },
  },
  type: "object",
  title: "TableUpdate",
  description: "Update model for a table.",
} as const

export const $TagAddedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "tag_added",
      title: "Type",
      default: "tag_added",
    },
    tag_id: {
      type: "string",
      format: "uuid",
      title: "Tag Id",
    },
    tag_ref: {
      type: "string",
      title: "Tag Ref",
    },
    tag_name: {
      type: "string",
      title: "Tag Name",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["tag_id", "tag_ref", "tag_name", "created_at"],
  title: "TagAddedEventRead",
  description: "Event for when a tag is added to a case.",
} as const

export const $TagCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 50,
      minLength: 1,
      title: "Name",
    },
    color: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Color",
      description: "Hex color code",
    },
  },
  type: "object",
  required: ["name"],
  title: "TagCreate",
  description: "Model for creating new tags with validation.",
} as const

export const $TagInput = {
  properties: {
    component_id: {
      type: "string",
      const: "tag-input",
      title: "Component Id",
      default: "tag-input",
    },
  },
  type: "object",
  title: "TagInput",
} as const

export const $TagRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      maxLength: 50,
      minLength: 1,
      title: "Name",
    },
    ref: {
      type: "string",
      title: "Ref",
      description:
        "Slug-like identifier derived from name, used for API lookups",
    },
    color: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Color",
      description: "Hex color code",
    },
  },
  type: "object",
  required: ["id", "name", "ref"],
  title: "TagRead",
  description: "Model for reading tag data with validation.",
} as const

export const $TagRemovedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "tag_removed",
      title: "Type",
      default: "tag_removed",
    },
    tag_id: {
      type: "string",
      format: "uuid",
      title: "Tag Id",
    },
    tag_ref: {
      type: "string",
      title: "Tag Ref",
    },
    tag_name: {
      type: "string",
      title: "Tag Name",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["tag_id", "tag_ref", "tag_name", "created_at"],
  title: "TagRemovedEventRead",
  description: "Event for when a tag is removed from a case.",
} as const

export const $TagUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 50,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    color: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Color",
      description: "Hex color code",
    },
  },
  type: "object",
  title: "TagUpdate",
  description: "Model for updating existing tags with validation.",
} as const

export const $TaskAssigneeChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "task_assignee_changed",
      title: "Type",
      default: "task_assignee_changed",
    },
    task_id: {
      type: "string",
      format: "uuid",
      title: "Task Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    old: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Old",
    },
    new: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "New",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["task_id", "title", "old", "new", "created_at"],
  title: "TaskAssigneeChangedEventRead",
  description: "Event for when a task assignee is changed.",
} as const

export const $TaskCreatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "task_created",
      title: "Type",
      default: "task_created",
    },
    task_id: {
      type: "string",
      format: "uuid",
      title: "Task Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["task_id", "title", "created_at"],
  title: "TaskCreatedEventRead",
  description: "Event for when a task is created for a case.",
} as const

export const $TaskDeletedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "task_deleted",
      title: "Type",
      default: "task_deleted",
    },
    task_id: {
      type: "string",
      format: "uuid",
      title: "Task Id",
    },
    title: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Title",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["task_id", "created_at"],
  title: "TaskDeletedEventRead",
  description: "Event for when a task is deleted for a case.",
} as const

export const $TaskPriorityChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "task_priority_changed",
      title: "Type",
      default: "task_priority_changed",
    },
    task_id: {
      type: "string",
      format: "uuid",
      title: "Task Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    old: {
      $ref: "#/components/schemas/CasePriority",
    },
    new: {
      $ref: "#/components/schemas/CasePriority",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["task_id", "title", "old", "new", "created_at"],
  title: "TaskPriorityChangedEventRead",
  description: "Event for when a task priority is changed.",
} as const

export const $TaskResult = {
  properties: {
    result: {
      oneOf: [
        {
          $ref: "#/components/schemas/InlineObject",
        },
        {
          $ref: "#/components/schemas/ExternalObject",
        },
        {
          $ref: "#/components/schemas/CollectionObject",
        },
      ],
      title: "Result",
      discriminator: {
        propertyName: "type",
        mapping: {
          collection: "#/components/schemas/CollectionObject",
          external: "#/components/schemas/ExternalObject",
          inline: "#/components/schemas/InlineObject",
        },
      },
    },
    result_typename: {
      type: "string",
      title: "Result Typename",
    },
    error: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Error",
    },
    error_typename: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error Typename",
    },
    interaction: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Interaction",
    },
    interaction_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Interaction Id",
    },
    interaction_type: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Interaction Type",
    },
    collection_index: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Collection Index",
    },
  },
  type: "object",
  required: ["result", "result_typename"],
  title: "TaskResult",
  description: `Result of executing a DSL node.

With uniform envelope design, \`result\` is always a StoredObject:
- InlineObject when data is small or externalization is disabled
- ExternalObject when data is large and externalization is enabled`,
} as const

export const $TaskStatusChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "task_status_changed",
      title: "Type",
      default: "task_status_changed",
    },
    task_id: {
      type: "string",
      format: "uuid",
      title: "Task Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    old: {
      $ref: "#/components/schemas/CaseTaskStatus",
    },
    new: {
      $ref: "#/components/schemas/CaseTaskStatus",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["task_id", "title", "old", "new", "created_at"],
  title: "TaskStatusChangedEventRead",
  description: "Event for when a task status is changed.",
} as const

export const $TaskWorkflowChangedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "task_workflow_changed",
      title: "Type",
      default: "task_workflow_changed",
    },
    task_id: {
      type: "string",
      format: "uuid",
      title: "Task Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    old: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
        {
          type: "null",
        },
      ],
      title: "Old",
    },
    new: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
        {
          type: "null",
        },
      ],
      title: "New",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["task_id", "title", "old", "new", "created_at"],
  title: "TaskWorkflowChangedEventRead",
  description: "Event for when a task workflow is changed.",
} as const

export const $TemplateAction = {
  properties: {
    type: {
      type: "string",
      const: "action",
      title: "Type",
      default: "action",
    },
    definition: {
      $ref: "#/components/schemas/TemplateActionDefinition",
    },
  },
  type: "object",
  required: ["definition"],
  title: "TemplateAction",
} as const

export const $TemplateActionDefinition = {
  properties: {
    name: {
      type: "string",
      title: "Name",
      description: "The action name",
    },
    namespace: {
      type: "string",
      title: "Namespace",
      description: "The namespace of the action",
    },
    title: {
      type: "string",
      title: "Title",
      description: "The title of the action",
    },
    description: {
      type: "string",
      title: "Description",
      description: "The description of the action",
      default: "",
    },
    display_group: {
      type: "string",
      title: "Display Group",
      description: "The display group of the action",
    },
    doc_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Doc Url",
      description: "Link to documentation",
    },
    author: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Author",
      description: "Author of the action",
    },
    deprecated: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Deprecated",
      description: "Marks action as deprecated along with message",
    },
    secrets: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/RegistrySecretType",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Secrets",
      description: "The secrets to pass to the action",
    },
    expects: {
      additionalProperties: {
        $ref: "#/components/schemas/ExpectedField-Output",
      },
      type: "object",
      title: "Expects",
      description: "The arguments to pass to the action",
    },
    steps: {
      items: {
        $ref: "#/components/schemas/ActionStep",
      },
      type: "array",
      title: "Steps",
      description: "The sequence of steps for the action",
    },
    returns: {
      anyOf: [
        {
          type: "string",
        },
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          additionalProperties: true,
          type: "object",
        },
      ],
      title: "Returns",
      description: "The result of the action",
    },
  },
  type: "object",
  required: [
    "name",
    "namespace",
    "title",
    "display_group",
    "expects",
    "steps",
    "returns",
  ],
  title: "TemplateActionDefinition",
} as const

export const $TemplateActionExprValidationResult = {
  properties: {
    type: {
      type: "string",
      const: "action_template",
      title: "Type",
      default: "action_template",
    },
    status: {
      type: "string",
      enum: ["success", "error"],
      title: "Status",
    },
    msg: {
      type: "string",
      title: "Msg",
      default: "",
    },
    detail: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ValidationDetail",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Detail",
    },
    ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Ref",
    },
    expression: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Expression",
    },
    expression_type: {
      $ref: "#/components/schemas/ExprType",
    },
    loc: {
      items: {
        anyOf: [
          {
            type: "string",
          },
          {
            type: "integer",
          },
        ],
      },
      type: "array",
      title: "Loc",
    },
  },
  type: "object",
  required: ["status", "expression_type", "loc"],
  title: "TemplateActionExprValidationResult",
  description: "Result of visiting an expression node.",
} as const

export const $TemplateActionValidationErrorType = {
  type: "string",
  enum: [
    "ACTION_NOT_FOUND",
    "ACTION_NAME_CONFLICT",
    "STEP_VALIDATION_ERROR",
    "EXPRESSION_VALIDATION_ERROR",
    "SERIALIZATION_ERROR",
  ],
  title: "TemplateActionValidationErrorType",
} as const

export const $Text = {
  properties: {
    component_id: {
      type: "string",
      const: "text",
      title: "Component Id",
      default: "text",
    },
  },
  type: "object",
  title: "Text",
} as const

export const $TextArea = {
  properties: {
    component_id: {
      type: "string",
      const: "text-area",
      title: "Component Id",
      default: "text-area",
    },
    rows: {
      type: "integer",
      title: "Rows",
      default: 4,
    },
    placeholder: {
      type: "string",
      title: "Placeholder",
      default: "",
    },
  },
  type: "object",
  title: "TextArea",
} as const

export const $TextBlock = {
  properties: {
    text: {
      type: "string",
      title: "Text",
    },
  },
  type: "object",
  required: ["text"],
  title: "TextBlock",
} as const

export const $TextUIPart = {
  properties: {
    type: {
      type: "string",
      const: "text",
      title: "Type",
    },
    text: {
      type: "string",
      title: "Text",
    },
    state: {
      type: "string",
      enum: ["streaming", "done"],
      title: "State",
    },
    providerMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Providermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "text"],
  title: "TextUIPart",
  description: "A text part of a message.",
} as const

export const $ThinkingBlock = {
  properties: {
    thinking: {
      type: "string",
      title: "Thinking",
    },
    signature: {
      type: "string",
      title: "Signature",
    },
  },
  type: "object",
  required: ["thinking", "signature"],
  title: "ThinkingBlock",
} as const

export const $TierCreate = {
  properties: {
    display_name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      title: "Display Name",
    },
    max_concurrent_workflows: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Workflows",
    },
    max_action_executions_per_workflow: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Action Executions Per Workflow",
    },
    max_concurrent_actions: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Actions",
    },
    api_rate_limit: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Rate Limit",
    },
    api_burst_capacity: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Burst Capacity",
    },
    entitlements: {
      $ref: "#/components/schemas/EntitlementsDict",
      default: {},
    },
    is_default: {
      type: "boolean",
      title: "Is Default",
      default: false,
    },
    sort_order: {
      type: "integer",
      title: "Sort Order",
      default: 0,
    },
  },
  type: "object",
  required: ["display_name"],
  title: "TierCreate",
  description: "Create tier request.",
} as const

export const $TierRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    display_name: {
      type: "string",
      title: "Display Name",
    },
    max_concurrent_workflows: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Workflows",
    },
    max_action_executions_per_workflow: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Action Executions Per Workflow",
    },
    max_concurrent_actions: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Actions",
    },
    api_rate_limit: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Rate Limit",
    },
    api_burst_capacity: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Burst Capacity",
    },
    entitlements: {
      $ref: "#/components/schemas/EntitlementsDict",
    },
    is_default: {
      type: "boolean",
      title: "Is Default",
    },
    sort_order: {
      type: "integer",
      title: "Sort Order",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "display_name",
    "max_concurrent_workflows",
    "max_action_executions_per_workflow",
    "max_concurrent_actions",
    "api_rate_limit",
    "api_burst_capacity",
    "entitlements",
    "is_default",
    "sort_order",
    "is_active",
    "created_at",
    "updated_at",
  ],
  title: "TierRead",
  description: "Tier response schema.",
} as const

export const $TierUpdate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    max_concurrent_workflows: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Workflows",
    },
    max_action_executions_per_workflow: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Action Executions Per Workflow",
    },
    max_concurrent_actions: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Max Concurrent Actions",
    },
    api_rate_limit: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Rate Limit",
    },
    api_burst_capacity: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Api Burst Capacity",
    },
    entitlements: {
      anyOf: [
        {
          $ref: "#/components/schemas/EntitlementsDict",
        },
        {
          type: "null",
        },
      ],
    },
    is_default: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Default",
    },
    sort_order: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Sort Order",
    },
    is_active: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Active",
    },
  },
  type: "object",
  title: "TierUpdate",
  description: "Update tier request.",
} as const

export const $Toggle = {
  properties: {
    label_on: {
      type: "string",
      title: "Label On",
      default: "On",
    },
    label_off: {
      type: "string",
      title: "Label Off",
      default: "Off",
    },
    component_id: {
      type: "string",
      const: "toggle",
      title: "Component Id",
      default: "toggle",
    },
  },
  type: "object",
  title: "Toggle",
} as const

export const $ToolApprovalFieldChange = {
  properties: {
    tool: {
      type: "string",
      title: "Tool",
    },
    old_value: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Old Value",
    },
    new_value: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "New Value",
    },
  },
  type: "object",
  required: ["tool"],
  title: "ToolApprovalFieldChange",
  description: "Approval diff for a single tool.",
} as const

export const $ToolApproved = {
  properties: {
    override_args: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Override Args",
    },
    kind: {
      type: "string",
      const: "tool-approved",
      title: "Kind",
      default: "tool-approved",
    },
  },
  type: "object",
  title: "ToolApproved",
} as const

export const $ToolDenied = {
  properties: {
    message: {
      type: "string",
      title: "Message",
      default: "The tool call was denied.",
    },
    kind: {
      type: "string",
      const: "tool-denied",
      title: "Kind",
      default: "tool-denied",
    },
  },
  type: "object",
  title: "ToolDenied",
} as const

export const $ToolResultBlock = {
  properties: {
    tool_use_id: {
      type: "string",
      title: "Tool Use Id",
    },
    content: {
      anyOf: [
        {
          type: "string",
        },
        {
          items: {
            additionalProperties: true,
            type: "object",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Content",
    },
    is_error: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Error",
    },
  },
  type: "object",
  required: ["tool_use_id"],
  title: "ToolResultBlock",
} as const

export const $ToolReturn = {
  properties: {
    return_value: {
      $ref: "#/components/schemas/ToolReturnContent",
    },
    content: {
      anyOf: [
        {
          type: "string",
        },
        {
          items: {
            anyOf: [
              {
                type: "string",
              },
              {
                oneOf: [
                  {
                    $ref: "#/components/schemas/ImageUrl",
                  },
                  {
                    $ref: "#/components/schemas/AudioUrl",
                  },
                  {
                    $ref: "#/components/schemas/DocumentUrl",
                  },
                  {
                    $ref: "#/components/schemas/VideoUrl",
                  },
                  {
                    $ref: "#/components/schemas/BinaryContent",
                  },
                ],
                discriminator: {
                  propertyName: "kind",
                  mapping: {
                    "audio-url": "#/components/schemas/AudioUrl",
                    binary: "#/components/schemas/BinaryContent",
                    "document-url": "#/components/schemas/DocumentUrl",
                    "image-url": "#/components/schemas/ImageUrl",
                    "video-url": "#/components/schemas/VideoUrl",
                  },
                },
              },
              {
                $ref: "#/components/schemas/CachePoint",
              },
            ],
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Content",
    },
    metadata: {
      title: "Metadata",
    },
    kind: {
      type: "string",
      const: "tool-return",
      title: "Kind",
      default: "tool-return",
    },
  },
  type: "object",
  required: ["return_value"],
  title: "ToolReturn",
} as const

export const $ToolReturnContent = {
  anyOf: [
    {
      oneOf: [
        {
          $ref: "#/components/schemas/ImageUrl",
        },
        {
          $ref: "#/components/schemas/AudioUrl",
        },
        {
          $ref: "#/components/schemas/DocumentUrl",
        },
        {
          $ref: "#/components/schemas/VideoUrl",
        },
        {
          $ref: "#/components/schemas/BinaryContent",
        },
      ],
      discriminator: {
        propertyName: "kind",
        mapping: {
          "audio-url": "#/components/schemas/AudioUrl",
          binary: "#/components/schemas/BinaryContent",
          "document-url": "#/components/schemas/DocumentUrl",
          "image-url": "#/components/schemas/ImageUrl",
          "video-url": "#/components/schemas/VideoUrl",
        },
      },
    },
    {
      items: {
        $ref: "#/components/schemas/ToolReturnContent",
      },
      type: "array",
    },
    {
      additionalProperties: {
        $ref: "#/components/schemas/ToolReturnContent",
      },
      type: "object",
    },
    {},
  ],
} as const

export const $ToolUIPartInputAvailable = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "input-available",
      title: "State",
    },
    input: {
      title: "Input",
    },
    providerExecuted: {
      type: "boolean",
      title: "Providerexecuted",
    },
    output: {
      type: "null",
      title: "Output",
    },
    errorText: {
      type: "null",
      title: "Errortext",
    },
    callProviderMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Callprovidermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolCallId", "state", "input"],
  title: "ToolUIPartInputAvailable",
} as const

export const $ToolUIPartInputStreaming = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "input-streaming",
      title: "State",
    },
    input: {
      title: "Input",
    },
    providerExecuted: {
      type: "boolean",
      title: "Providerexecuted",
    },
    output: {
      type: "null",
      title: "Output",
    },
    errorText: {
      type: "null",
      title: "Errortext",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolCallId", "state"],
  title: "ToolUIPartInputStreaming",
} as const

export const $ToolUIPartOutputAvailable = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "output-available",
      title: "State",
    },
    input: {
      title: "Input",
    },
    output: {
      title: "Output",
    },
    errorText: {
      type: "null",
      title: "Errortext",
    },
    providerExecuted: {
      type: "boolean",
      title: "Providerexecuted",
    },
    callProviderMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Callprovidermetadata",
    },
    preliminary: {
      type: "boolean",
      title: "Preliminary",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolCallId", "state", "input", "output"],
  title: "ToolUIPartOutputAvailable",
} as const

export const $ToolUIPartOutputError = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    toolCallId: {
      type: "string",
      title: "Toolcallid",
    },
    state: {
      type: "string",
      const: "output-error",
      title: "State",
    },
    input: {
      title: "Input",
    },
    rawInput: {
      title: "Rawinput",
    },
    output: {
      type: "null",
      title: "Output",
    },
    errorText: {
      type: "string",
      title: "Errortext",
    },
    providerExecuted: {
      type: "boolean",
      title: "Providerexecuted",
    },
    callProviderMetadata: {
      additionalProperties: {
        additionalProperties: true,
        type: "object",
      },
      type: "object",
      title: "Callprovidermetadata",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["type", "toolCallId", "state", "errorText"],
  title: "ToolUIPartOutputError",
} as const

export const $ToolUseBlock = {
  properties: {
    id: {
      type: "string",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    input: {
      additionalProperties: true,
      type: "object",
      title: "Input",
    },
  },
  type: "object",
  required: ["id", "name", "input"],
  title: "ToolUseBlock",
} as const

export const $Trigger = {
  properties: {
    type: {
      type: "string",
      enum: ["schedule", "webhook"],
      title: "Type",
    },
    ref: {
      type: "string",
      pattern: "^[a-z0-9_]+$",
      title: "Ref",
    },
    args: {
      additionalProperties: true,
      type: "object",
      title: "Args",
    },
  },
  type: "object",
  required: ["type", "ref"],
  title: "Trigger",
} as const

export const $TriggerType = {
  type: "string",
  enum: ["manual", "scheduled", "webhook", "case"],
  title: "TriggerType",
  description: "Trigger type for a workflow execution.",
} as const

export const $UIMessage = {
  properties: {
    id: {
      type: "string",
      title: "Id",
    },
    role: {
      type: "string",
      enum: ["system", "user", "assistant"],
      title: "Role",
    },
    metadata: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Metadata",
    },
    parts: {
      items: {
        anyOf: [
          {
            $ref: "#/components/schemas/TextUIPart",
          },
          {
            $ref: "#/components/schemas/ReasoningUIPart",
          },
          {
            $ref: "#/components/schemas/SourceUrlUIPart",
          },
          {
            $ref: "#/components/schemas/SourceDocumentUIPart",
          },
          {
            $ref: "#/components/schemas/FileUIPart",
          },
          {
            $ref: "#/components/schemas/StepStartUIPart",
          },
          {
            $ref: "#/components/schemas/DynamicToolUIPartInputStreaming",
          },
          {
            $ref: "#/components/schemas/DynamicToolUIPartInputAvailable",
          },
          {
            $ref: "#/components/schemas/DynamicToolUIPartOutputAvailable",
          },
          {
            $ref: "#/components/schemas/DynamicToolUIPartOutputError",
          },
          {
            $ref: "#/components/schemas/ToolUIPartInputStreaming",
          },
          {
            $ref: "#/components/schemas/ToolUIPartInputAvailable",
          },
          {
            $ref: "#/components/schemas/ToolUIPartOutputAvailable",
          },
          {
            $ref: "#/components/schemas/ToolUIPartOutputError",
          },
          {
            $ref: "#/components/schemas/DataUIPart",
          },
        ],
      },
      type: "array",
      title: "Parts",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["id", "role", "parts"],
  title: "UIMessage",
  description: `Pydantic model for AI SDK UI Messages, used for validation between
frontend and backend.`,
} as const

export const $UnreadableTemporalPayload = {
  properties: {
    error: {
      type: "string",
      const: "unreadable_temporal_payload",
      title: "Error",
      default: "unreadable_temporal_payload",
    },
    error_type: {
      type: "string",
      title: "Error Type",
    },
    encoding: {
      type: "string",
      title: "Encoding",
    },
    payload_size_bytes: {
      type: "integer",
      title: "Payload Size Bytes",
    },
  },
  type: "object",
  required: ["error_type", "encoding", "payload_size_bytes"],
  title: "UnreadableTemporalPayload",
  description:
    "Structured placeholder for Temporal payloads that cannot be decoded.",
} as const

export const $UpdatedEventRead = {
  properties: {
    wf_exec_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Wf Exec Id",
      description: "The execution ID of the workflow that triggered the event.",
    },
    type: {
      type: "string",
      const: "case_updated",
      title: "Type",
      default: "case_updated",
    },
    field: {
      type: "string",
      const: "summary",
      title: "Field",
    },
    old: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Old",
    },
    new: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "New",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
      description: "The user who performed the action.",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
      description: "The timestamp of the event.",
    },
  },
  type: "object",
  required: ["field", "old", "new", "created_at"],
  title: "UpdatedEventRead",
  description: "Event for when a case is updated.",
} as const

export const $UserCreate = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    password: {
      type: "string",
      title: "Password",
    },
    is_active: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Active",
      default: true,
    },
    is_superuser: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Superuser",
      default: false,
    },
    is_verified: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Verified",
      default: false,
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    invitation_token: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Invitation Token",
    },
  },
  type: "object",
  required: ["email", "password"],
  title: "UserCreate",
} as const

export const $UserMessage = {
  properties: {
    content: {
      anyOf: [
        {
          type: "string",
        },
        {
          items: {
            anyOf: [
              {
                $ref: "#/components/schemas/TextBlock",
              },
              {
                $ref: "#/components/schemas/ThinkingBlock",
              },
              {
                $ref: "#/components/schemas/ToolUseBlock",
              },
              {
                $ref: "#/components/schemas/ToolResultBlock",
              },
            ],
          },
          type: "array",
        },
      ],
      title: "Content",
    },
    uuid: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Uuid",
    },
    parent_tool_use_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Tool Use Id",
    },
    tool_use_result: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tool Use Result",
    },
  },
  type: "object",
  required: ["content"],
  title: "UserMessage",
} as const

export const $UserRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
      default: true,
    },
    is_superuser: {
      type: "boolean",
      title: "Is Superuser",
      default: false,
    },
    is_verified: {
      type: "boolean",
      title: "Is Verified",
      default: false,
    },
    role: {
      $ref: "#/components/schemas/UserRole",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    settings: {
      additionalProperties: true,
      type: "object",
      title: "Settings",
    },
  },
  type: "object",
  required: ["id", "email", "role", "settings"],
  title: "UserRead",
} as const

export const $UserReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role: {
      $ref: "#/components/schemas/UserRole",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
  },
  type: "object",
  required: ["id", "email", "role"],
  title: "UserReadMinimal",
} as const

export const $UserRole = {
  type: "string",
  enum: ["basic", "admin"],
  title: "UserRole",
} as const

export const $UserRoleAssignmentCreate = {
  properties: {
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
      description: "User ID to assign role to",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
      description: "Role ID to assign to the user",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
      description:
        "Workspace ID for workspace-level assignment. If None, creates org-wide assignment.",
    },
  },
  type: "object",
  required: ["user_id", "role_id"],
  title: "UserRoleAssignmentCreate",
  description: "Create schema for a user role assignment.",
} as const

export const $UserRoleAssignmentList = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/UserRoleAssignmentReadWithDetails",
      },
      type: "array",
      title: "Items",
    },
    total: {
      type: "integer",
      title: "Total",
    },
  },
  type: "object",
  required: ["items", "total"],
  title: "UserRoleAssignmentList",
  description: "Response schema for listing user role assignments.",
} as const

export const $UserRoleAssignmentReadWithDetails = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
    },
    assigned_at: {
      type: "string",
      format: "date-time",
      title: "Assigned At",
    },
    assigned_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Assigned By",
    },
    user_email: {
      type: "string",
      title: "User Email",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    workspace_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Name",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "user_id",
    "role_id",
    "assigned_at",
    "user_email",
    "role_name",
  ],
  title: "UserRoleAssignmentReadWithDetails",
  description:
    "Read schema for a user role assignment with user and role details.",
} as const

export const $UserRoleAssignmentUpdate = {
  properties: {
    role_id: {
      type: "string",
      format: "uuid",
      title: "Role Id",
      description: "New role ID to assign",
    },
  },
  type: "object",
  required: ["role_id"],
  title: "UserRoleAssignmentUpdate",
  description: "Update schema for a user role assignment (change role only).",
} as const

export const $UserScopesRead = {
  properties: {
    scopes: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Scopes",
      description: "List of effective scope strings for the user",
    },
  },
  type: "object",
  required: ["scopes"],
  title: "UserScopesRead",
  description: "Read schema for a user's effective scopes.",
} as const

export const $UserUpdate = {
  properties: {
    password: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Password",
    },
    email: {
      anyOf: [
        {
          type: "string",
          format: "email",
        },
        {
          type: "null",
        },
      ],
      title: "Email",
    },
    is_active: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Active",
    },
    is_superuser: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Superuser",
    },
    is_verified: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Is Verified",
    },
    role: {
      anyOf: [
        {
          $ref: "#/components/schemas/UserRole",
        },
        {
          type: "null",
        },
      ],
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    settings: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Settings",
    },
  },
  type: "object",
  title: "UserUpdate",
} as const

export const $ValidationDetail = {
  properties: {
    type: {
      type: "string",
      title: "Type",
    },
    msg: {
      type: "string",
      title: "Msg",
    },
    loc: {
      anyOf: [
        {
          items: {
            anyOf: [
              {
                type: "integer",
              },
              {
                type: "string",
              },
            ],
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Loc",
    },
  },
  type: "object",
  required: ["type", "msg"],
  title: "ValidationDetail",
} as const

export const $ValidationError = {
  properties: {
    loc: {
      items: {
        anyOf: [
          {
            type: "string",
          },
          {
            type: "integer",
          },
        ],
      },
      type: "array",
      title: "Location",
    },
    msg: {
      type: "string",
      title: "Message",
    },
    type: {
      type: "string",
      title: "Error Type",
    },
  },
  type: "object",
  required: ["loc", "msg", "type"],
  title: "ValidationError",
} as const

export const $ValidationResult = {
  oneOf: [
    {
      $ref: "#/components/schemas/DSLValidationResult",
    },
    {
      $ref: "#/components/schemas/SecretValidationResult",
    },
    {
      $ref: "#/components/schemas/ExprValidationResult",
    },
    {
      $ref: "#/components/schemas/TemplateActionExprValidationResult",
    },
    {
      $ref: "#/components/schemas/ActionValidationResult",
    },
  ],
  title: "ValidationResult",
  discriminator: {
    propertyName: "type",
    mapping: {
      action: "#/components/schemas/ActionValidationResult",
      action_template:
        "#/components/schemas/TemplateActionExprValidationResult",
      dsl: "#/components/schemas/DSLValidationResult",
      expression: "#/components/schemas/ExprValidationResult",
      secret: "#/components/schemas/SecretValidationResult",
    },
  },
} as const

export const $VariableCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 255,
      minLength: 1,
      pattern: "[a-z0-9_]+",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    values: {
      patternProperties: {
        "[a-zA-Z0-9_]+": {},
      },
      propertyNames: {
        maxLength: 255,
        minLength: 1,
      },
      type: "object",
      maxProperties: 1000,
      minProperties: 1,
      title: "Values",
    },
    tags: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    environment: {
      type: "string",
      title: "Environment",
      default: "default",
    },
  },
  type: "object",
  required: ["name", "values"],
  title: "VariableCreate",
} as const

export const $VariableRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      pattern: "[a-z0-9_]+",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    values: {
      additionalProperties: true,
      type: "object",
      title: "Values",
    },
    environment: {
      type: "string",
      title: "Environment",
    },
    tags: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "name",
    "description",
    "values",
    "environment",
    "tags",
    "workspace_id",
    "created_at",
    "updated_at",
  ],
  title: "VariableRead",
} as const

export const $VariableReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      pattern: "[a-z0-9_]+",
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    values: {
      additionalProperties: true,
      type: "object",
      title: "Values",
    },
    environment: {
      type: "string",
      title: "Environment",
    },
  },
  type: "object",
  required: ["id", "name", "description", "values", "environment"],
  title: "VariableReadMinimal",
} as const

export const $VariableUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 1,
          pattern: "[a-z0-9_]+",
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 255,
          minLength: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
    },
    values: {
      anyOf: [
        {
          patternProperties: {
            "[a-zA-Z0-9_]+": {},
          },
          propertyNames: {
            maxLength: 255,
            minLength: 1,
          },
          type: "object",
          maxProperties: 1000,
          minProperties: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Values",
    },
    tags: {
      anyOf: [
        {
          additionalProperties: {
            type: "string",
          },
          type: "object",
          maxProperties: 1000,
          minProperties: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    environment: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Environment",
    },
  },
  type: "object",
  title: "VariableUpdate",
} as const

export const $VercelChatRequest = {
  properties: {
    kind: {
      type: "string",
      const: "vercel",
      title: "Kind",
      default: "vercel",
    },
    message: {
      $ref: "#/components/schemas/UIMessage",
      description: "User message in Vercel UI format",
    },
    model: {
      type: "string",
      title: "Model",
      description: "AI model to use",
      default: "gpt-4o-mini",
    },
    model_provider: {
      type: "string",
      maxLength: 50,
      minLength: 1,
      title: "Model Provider",
      description: "AI model provider",
      default: "openai",
    },
    base_url: {
      anyOf: [
        {
          type: "string",
          maxLength: 500,
        },
        {
          type: "null",
        },
      ],
      title: "Base Url",
      description: "Optional base URL for the model provider",
    },
  },
  type: "object",
  required: ["message"],
  title: "VercelChatRequest",
  description: "Vercel AI SDK format request with structured UI messages.",
} as const

export const $VersionDiff = {
  properties: {
    base_version_id: {
      type: "string",
      format: "uuid",
      title: "Base Version Id",
    },
    base_version: {
      type: "string",
      title: "Base Version",
    },
    compare_version_id: {
      type: "string",
      format: "uuid",
      title: "Compare Version Id",
    },
    compare_version: {
      type: "string",
      title: "Compare Version",
    },
    actions_added: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Actions Added",
    },
    actions_removed: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Actions Removed",
    },
    actions_modified: {
      items: {
        $ref: "#/components/schemas/ActionChange",
      },
      type: "array",
      title: "Actions Modified",
    },
    total_changes: {
      type: "integer",
      title: "Total Changes",
      default: 0,
    },
  },
  type: "object",
  required: [
    "base_version_id",
    "base_version",
    "compare_version_id",
    "compare_version",
  ],
  title: "VersionDiff",
  description: "Result of comparing two registry versions.",
} as const

export const $VertexAICatalogCreate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "vertex_ai",
      title: "Model Provider",
    },
    model_name: {
      type: "string",
      maxLength: 500,
      minLength: 1,
      title: "Model Name",
    },
    vertex_model: {
      type: "string",
      minLength: 1,
      title: "Vertex Model",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider", "model_name", "vertex_model"],
  title: "VertexAICatalogCreate",
  description: "Vertex AI catalog entry.",
} as const

export const $VertexAICatalogUpdate = {
  properties: {
    display_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Display Name",
    },
    model_provider: {
      type: "string",
      const: "vertex_ai",
      title: "Model Provider",
    },
    vertex_model: {
      type: "string",
      minLength: 1,
      title: "Vertex Model",
    },
  },
  additionalProperties: false,
  type: "object",
  required: ["model_provider", "vertex_model"],
  title: "VertexAICatalogUpdate",
} as const

export const $VideoUrl = {
  properties: {
    url: {
      type: "string",
      title: "Url",
    },
    force_download: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "string",
          const: "allow-local",
        },
      ],
      title: "Force Download",
      default: false,
    },
    vendor_metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Vendor Metadata",
    },
    kind: {
      type: "string",
      const: "video-url",
      title: "Kind",
      default: "video-url",
    },
    media_type: {
      type: "string",
      title: "Media Type",
      description:
        "Return the media type of the file, based on the URL or the provided `media_type`.",
      readOnly: true,
    },
    identifier: {
      type: "string",
      title: "Identifier",
      description: `The identifier of the file, such as a unique ID.

This identifier can be provided to the model in a message to allow it to refer to this file in a tool call argument,
and the tool can look up the file in question by iterating over the message history and finding the matching \`FileUrl\`.

This identifier is only automatically passed to the model when the \`FileUrl\` is returned by a tool.
If you're passing the \`FileUrl\` as a user message, it's up to you to include a separate text part with the identifier,
e.g. "This is file <identifier>:" preceding the \`FileUrl\`.

It's also included in inline-text delimiters for providers that require inlining text documents, so the model can
distinguish multiple files.`,
      readOnly: true,
    },
  },
  type: "object",
  required: ["url", "media_type", "identifier"],
  title: "VideoUrl",
  description: "A URL to a video.",
} as const

export const $WaitResultOutput = {
  anyOf: [
    {
      $ref: "#/components/schemas/WebhookStoredObjectInlineResponse",
    },
    {
      $ref: "#/components/schemas/WebhookStoredObjectDownloadResponse",
    },
  ],
} as const

export const $WaitResultUnwrapOverflowResponse = {
  properties: {
    detail: {
      $ref: "#/components/schemas/WebhookStoredObjectDownloadResponse",
    },
  },
  type: "object",
  required: ["detail"],
  title: "WaitResultUnwrapOverflowResponse",
} as const

export const $WaitStrategy = {
  type: "string",
  enum: ["wait", "detach"],
  title: "WaitStrategy",
} as const

export const $WatchtowerAgentListResponse = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/WatchtowerAgentRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      default: false,
    },
  },
  type: "object",
  required: ["items"],
  title: "WatchtowerAgentListResponse",
  description: "Paginated response for Watchtower agents.",
} as const

export const $WatchtowerAgentRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    fingerprint_hash: {
      type: "string",
      title: "Fingerprint Hash",
    },
    agent_type: {
      $ref: "#/components/schemas/WatchtowerAgentType",
    },
    agent_source: {
      type: "string",
      title: "Agent Source",
    },
    agent_icon_key: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Icon Key",
    },
    raw_user_agent: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Raw User Agent",
    },
    raw_client_info: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Raw Client Info",
    },
    auth_client_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Auth Client Id",
    },
    last_user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Last User Id",
    },
    last_user_email: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last User Email",
    },
    last_user_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last User Name",
    },
    first_seen_at: {
      type: "string",
      format: "date-time",
      title: "First Seen At",
    },
    last_seen_at: {
      type: "string",
      format: "date-time",
      title: "Last Seen At",
    },
    blocked_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Blocked At",
    },
    blocked_reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Blocked Reason",
    },
    status: {
      $ref: "#/components/schemas/WatchtowerAgentStatus",
    },
    active_session_count: {
      type: "integer",
      title: "Active Session Count",
      default: 0,
    },
    inactive_session_count: {
      type: "integer",
      title: "Inactive Session Count",
      default: 0,
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "fingerprint_hash",
    "agent_type",
    "agent_source",
    "agent_icon_key",
    "raw_user_agent",
    "raw_client_info",
    "auth_client_id",
    "last_user_id",
    "last_user_email",
    "last_user_name",
    "first_seen_at",
    "last_seen_at",
    "blocked_at",
    "blocked_reason",
    "status",
  ],
  title: "WatchtowerAgentRead",
  description: "Watchtower agent row for monitor list views.",
} as const

export const $WatchtowerAgentSessionListResponse = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/WatchtowerAgentSessionRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      default: false,
    },
  },
  type: "object",
  required: ["items"],
  title: "WatchtowerAgentSessionListResponse",
  description: "Paginated response for Watchtower sessions.",
} as const

export const $WatchtowerAgentSessionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    agent_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Id",
    },
    session_state: {
      type: "string",
      title: "Session State",
    },
    auth_transaction_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Auth Transaction Id",
    },
    auth_client_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Auth Client Id",
    },
    oauth_callback_seen_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Oauth Callback Seen At",
    },
    agent_session_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Agent Session Id",
    },
    initialize_seen_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Initialize Seen At",
    },
    user_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "User Id",
    },
    user_email: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "User Email",
    },
    user_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "User Name",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
    first_seen_at: {
      type: "string",
      format: "date-time",
      title: "First Seen At",
    },
    last_seen_at: {
      type: "string",
      format: "date-time",
      title: "Last Seen At",
    },
    revoked_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Revoked At",
    },
    revoked_reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Revoked Reason",
    },
    status: {
      $ref: "#/components/schemas/WatchtowerAgentSessionStatus",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "agent_id",
    "session_state",
    "auth_transaction_id",
    "auth_client_id",
    "oauth_callback_seen_at",
    "agent_session_id",
    "initialize_seen_at",
    "user_id",
    "user_email",
    "user_name",
    "workspace_id",
    "first_seen_at",
    "last_seen_at",
    "revoked_at",
    "revoked_reason",
    "status",
  ],
  title: "WatchtowerAgentSessionRead",
  description: "Watchtower agent session row for monitor list views.",
} as const

export const $WatchtowerAgentSessionStatus = {
  type: "string",
  enum: ["active", "idle", "revoked"],
  title: "WatchtowerAgentSessionStatus",
  description: "Derived status for Watchtower agent sessions in monitor APIs.",
} as const

export const $WatchtowerAgentStatus = {
  type: "string",
  enum: ["active", "idle", "blocked"],
  title: "WatchtowerAgentStatus",
  description: "Derived status for Watchtower agents in monitor APIs.",
} as const

export const $WatchtowerAgentToolCallListResponse = {
  properties: {
    items: {
      items: {
        $ref: "#/components/schemas/WatchtowerAgentToolCallRead",
      },
      type: "array",
      title: "Items",
    },
    next_cursor: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Next Cursor",
    },
    has_more: {
      type: "boolean",
      title: "Has More",
      default: false,
    },
  },
  type: "object",
  required: ["items"],
  title: "WatchtowerAgentToolCallListResponse",
  description: "Paginated response for Watchtower tool calls.",
} as const

export const $WatchtowerAgentToolCallRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    agent_id: {
      type: "string",
      format: "uuid",
      title: "Agent Id",
    },
    agent_session_id: {
      type: "string",
      format: "uuid",
      title: "Agent Session Id",
    },
    workspace_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Workspace Id",
    },
    tool_name: {
      type: "string",
      title: "Tool Name",
    },
    call_status: {
      $ref: "#/components/schemas/WatchtowerToolCallStatus",
    },
    latency_ms: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Latency Ms",
    },
    args_redacted: {
      additionalProperties: true,
      type: "object",
      title: "Args Redacted",
    },
    error_redacted: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error Redacted",
    },
    called_at: {
      type: "string",
      format: "date-time",
      title: "Called At",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "agent_id",
    "agent_session_id",
    "workspace_id",
    "tool_name",
    "call_status",
    "latency_ms",
    "args_redacted",
    "error_redacted",
    "called_at",
  ],
  title: "WatchtowerAgentToolCallRead",
  description: "Watchtower tool-call event row.",
} as const

export const $WatchtowerAgentType = {
  type: "string",
  enum: [
    "claude_code",
    "codex",
    "cursor",
    "windsurf",
    "opencode",
    "openclaw",
    "unknown",
  ],
  title: "WatchtowerAgentType",
  description: "Normalized local-agent classifications stored by Watchtower.",
} as const

export const $WatchtowerDisableAgentRequest = {
  properties: {
    reason: {
      anyOf: [
        {
          type: "string",
          maxLength: 2000,
        },
        {
          type: "null",
        },
      ],
      title: "Reason",
    },
  },
  type: "object",
  title: "WatchtowerDisableAgentRequest",
  description: "Request payload for disabling an agent.",
} as const

export const $WatchtowerRevokeAgentSessionRequest = {
  properties: {
    reason: {
      anyOf: [
        {
          type: "string",
          maxLength: 2000,
        },
        {
          type: "null",
        },
      ],
      title: "Reason",
    },
  },
  type: "object",
  title: "WatchtowerRevokeAgentSessionRequest",
  description: "Request payload for session revocation.",
} as const

export const $WatchtowerToolCallStatus = {
  type: "string",
  enum: ["success", "error", "timeout", "rejected", "blocked"],
  title: "WatchtowerToolCallStatus",
  description: "Tool call result status for Watchtower monitor APIs.",
} as const

export const $WebhookApiKeyGenerateResponse = {
  properties: {
    api_key: {
      type: "string",
      title: "Api Key",
    },
    preview: {
      type: "string",
      title: "Preview",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
  },
  type: "object",
  required: ["api_key", "preview", "created_at"],
  title: "WebhookApiKeyGenerateResponse",
} as const

export const $WebhookApiKeyRead = {
  properties: {
    preview: {
      type: "string",
      title: "Preview",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    last_used_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Last Used At",
    },
    revoked_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Revoked At",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
      default: false,
    },
  },
  type: "object",
  required: ["preview", "created_at"],
  title: "WebhookApiKeyRead",
} as const

export const $WebhookCreate = {
  properties: {
    status: {
      $ref: "#/components/schemas/WebhookStatus",
      default: "offline",
    },
    methods: {
      items: {
        $ref: "#/components/schemas/WebhookMethod",
      },
      type: "array",
      title: "Methods",
      description: "Methods to allow",
    },
    entrypoint_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Entrypoint Ref",
    },
    allowlisted_cidrs: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Allowlisted Cidrs",
    },
  },
  type: "object",
  title: "WebhookCreate",
} as const

export const $WebhookMethod = {
  type: "string",
  enum: ["GET", "POST"],
} as const

export const $WebhookRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    secret: {
      type: "string",
      title: "Secret",
    },
    status: {
      $ref: "#/components/schemas/WebhookStatus",
    },
    entrypoint_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Entrypoint Ref",
    },
    allowlisted_cidrs: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Allowlisted Cidrs",
    },
    filters: {
      additionalProperties: true,
      type: "object",
      title: "Filters",
    },
    methods: {
      items: {
        $ref: "#/components/schemas/WebhookMethod",
      },
      type: "array",
      title: "Methods",
      description: "Methods to allow",
    },
    workflow_id: {
      type: "string",
      title: "Workflow Id",
    },
    url: {
      type: "string",
      title: "Url",
    },
    api_key: {
      anyOf: [
        {
          $ref: "#/components/schemas/WebhookApiKeyRead",
        },
        {
          type: "null",
        },
      ],
    },
  },
  type: "object",
  required: ["id", "secret", "status", "workflow_id", "url"],
  title: "WebhookRead",
} as const

export const $WebhookStatus = {
  type: "string",
  enum: ["online", "offline"],
} as const

export const $WebhookStoredObjectDownloadResponse = {
  properties: {
    kind: {
      type: "string",
      enum: ["download_file", "download_export"],
      title: "Kind",
    },
    download_url: {
      type: "string",
      title: "Download Url",
    },
    expires_in_seconds: {
      type: "integer",
      title: "Expires In Seconds",
    },
    content_type: {
      type: "string",
      title: "Content Type",
    },
    size_bytes: {
      type: "integer",
      title: "Size Bytes",
    },
  },
  type: "object",
  required: [
    "kind",
    "download_url",
    "expires_in_seconds",
    "content_type",
    "size_bytes",
  ],
  title: "WebhookStoredObjectDownloadResponse",
} as const

export const $WebhookStoredObjectInlineResponse = {
  properties: {
    kind: {
      type: "string",
      const: "value",
      title: "Kind",
    },
    value: {
      title: "Value",
    },
  },
  type: "object",
  required: ["kind", "value"],
  title: "WebhookStoredObjectInlineResponse",
} as const

export const $WebhookUpdate = {
  properties: {
    status: {
      anyOf: [
        {
          $ref: "#/components/schemas/WebhookStatus",
        },
        {
          type: "null",
        },
      ],
    },
    methods: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/WebhookMethod",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Methods",
    },
    entrypoint_ref: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Entrypoint Ref",
    },
    allowlisted_cidrs: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Allowlisted Cidrs",
    },
  },
  type: "object",
  title: "WebhookUpdate",
} as const

export const $WorkflowAlias = {
  properties: {
    component_id: {
      type: "string",
      const: "workflow-alias",
      title: "Component Id",
      default: "workflow-alias",
    },
  },
  type: "object",
  title: "WorkflowAlias",
} as const

export const $WorkflowCommitResponse = {
  properties: {
    workflow_id: {
      type: "string",
      pattern: "wf_[0-9a-zA-Z]+",
      title: "Workflow Id",
    },
    status: {
      type: "string",
      enum: ["success", "failure"],
      title: "Status",
    },
    message: {
      type: "string",
      title: "Message",
    },
    errors: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/ValidationResult",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Errors",
    },
    metadata: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Metadata",
    },
  },
  type: "object",
  required: ["workflow_id", "status", "message"],
  title: "WorkflowCommitResponse",
} as const

export const $WorkflowDefinitionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workflow_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    version: {
      type: "integer",
      title: "Version",
    },
    content: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Content",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "workflow_id",
    "workspace_id",
    "version",
    "created_at",
    "updated_at",
  ],
  title: "WorkflowDefinitionRead",
  description: "API response model for persisted workflow definitions.",
} as const

export const $WorkflowDefinitionReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    version: {
      type: "integer",
      title: "Version",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
  },
  type: "object",
  required: ["id", "version", "created_at"],
  title: "WorkflowDefinitionReadMinimal",
} as const

export const $WorkflowDirectoryItem = {
  properties: {
    id: {
      type: "string",
      pattern: "wf_[0-9a-zA-Z]+",
      title: "Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    description: {
      type: "string",
      title: "Description",
    },
    status: {
      type: "string",
      title: "Status",
    },
    icon_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Icon Url",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    version: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Version",
    },
    tags: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/TagRead",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    alias: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Alias",
    },
    error_handler: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error Handler",
    },
    latest_definition: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkflowDefinitionReadMinimal",
        },
        {
          type: "null",
        },
      ],
    },
    folder_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Folder Id",
    },
    trigger_summary: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkflowTriggerSummary",
        },
        {
          type: "null",
        },
      ],
    },
    type: {
      type: "string",
      const: "workflow",
      title: "Type",
    },
  },
  type: "object",
  required: [
    "id",
    "title",
    "description",
    "status",
    "icon_url",
    "created_at",
    "updated_at",
    "version",
    "type",
  ],
  title: "WorkflowDirectoryItem",
} as const

export const $WorkflowDslPublish = {
  properties: {
    message: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Message",
    },
    branch: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Branch",
    },
    create_pr: {
      type: "boolean",
      title: "Create Pr",
      default: false,
    },
    pr_base_branch: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Pr Base Branch",
    },
  },
  type: "object",
  title: "WorkflowDslPublish",
} as const

export const $WorkflowDslPublishResult = {
  properties: {
    status: {
      type: "string",
      enum: ["committed", "no_op"],
      title: "Status",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    branch: {
      type: "string",
      title: "Branch",
    },
    base_branch: {
      type: "string",
      title: "Base Branch",
    },
    pr_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Pr Url",
    },
    pr_number: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Pr Number",
    },
    pr_reused: {
      type: "boolean",
      title: "Pr Reused",
      default: false,
    },
    message: {
      type: "string",
      title: "Message",
    },
  },
  type: "object",
  required: ["status", "branch", "base_branch", "message"],
  title: "WorkflowDslPublishResult",
} as const

export const $WorkflowEntrypointValidationRequest = {
  properties: {
    expects: {
      anyOf: [
        {
          additionalProperties: {
            $ref: "#/components/schemas/ExpectedField-Input",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Expects",
    },
  },
  type: "object",
  title: "WorkflowEntrypointValidationRequest",
} as const

export const $WorkflowEntrypointValidationResponse = {
  properties: {
    valid: {
      type: "boolean",
      title: "Valid",
    },
    errors: {
      items: {
        $ref: "#/components/schemas/ValidationResult",
      },
      type: "array",
      title: "Errors",
    },
  },
  type: "object",
  required: ["valid"],
  title: "WorkflowEntrypointValidationResponse",
} as const

export const $WorkflowEventType = {
  type: "string",
  enum: [
    "WORKFLOW_EXECUTION_STARTED",
    "WORKFLOW_EXECUTION_COMPLETED",
    "WORKFLOW_EXECUTION_FAILED",
    "WORKFLOW_EXECUTION_TERMINATED",
    "WORKFLOW_EXECUTION_CANCELED",
    "WORKFLOW_EXECUTION_CONTINUED_AS_NEW",
    "WORKFLOW_EXECUTION_TIMED_OUT",
    "ACTIVITY_TASK_SCHEDULED",
    "ACTIVITY_TASK_STARTED",
    "ACTIVITY_TASK_COMPLETED",
    "ACTIVITY_TASK_FAILED",
    "ACTIVITY_TASK_TIMED_OUT",
    "ACTIVITY_TASK_CANCELED",
    "CHILD_WORKFLOW_EXECUTION_STARTED",
    "CHILD_WORKFLOW_EXECUTION_COMPLETED",
    "CHILD_WORKFLOW_EXECUTION_FAILED",
    "CHILD_WORKFLOW_EXECUTION_CANCELED",
    "CHILD_WORKFLOW_EXECUTION_TERMINATED",
    "START_CHILD_WORKFLOW_EXECUTION_INITIATED",
    "CHILD_WORKFLOW_EXECUTION_TIMED_OUT",
    "WORKFLOW_EXECUTION_SIGNALED",
    "WORKFLOW_EXECUTION_UPDATE_ACCEPTED",
    "WORKFLOW_EXECUTION_UPDATE_REJECTED",
    "WORKFLOW_EXECUTION_UPDATE_COMPLETED",
  ],
  title: "WorkflowEventType",
  description: "The event types we care about.",
} as const

export const $WorkflowExecutionBulkResetItemResult = {
  properties: {
    execution_id: {
      type: "string",
      pattern:
        "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      title: "Execution Id",
    },
    ok: {
      type: "boolean",
      title: "Ok",
      default: false,
    },
    new_run_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "New Run Id",
    },
    error: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error",
    },
  },
  type: "object",
  required: ["execution_id"],
  title: "WorkflowExecutionBulkResetItemResult",
} as const

export const $WorkflowExecutionBulkResetRequest = {
  properties: {
    execution_ids: {
      items: {
        type: "string",
        pattern:
          "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      },
      type: "array",
      maxItems: 100,
      minItems: 1,
      title: "Execution Ids",
    },
    event_id: {
      anyOf: [
        {
          type: "integer",
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Event Id",
      description:
        "Temporal history event id to reset from. If omitted, reset uses start.",
    },
    reason: {
      anyOf: [
        {
          type: "string",
          maxLength: 1024,
        },
        {
          type: "null",
        },
      ],
      title: "Reason",
    },
    reapply_type: {
      $ref: "#/components/schemas/WorkflowExecutionResetReapplyType",
      default: "all_eligible",
    },
  },
  type: "object",
  title: "WorkflowExecutionBulkResetRequest",
} as const

export const $WorkflowExecutionBulkResetResponse = {
  properties: {
    results: {
      items: {
        $ref: "#/components/schemas/WorkflowExecutionBulkResetItemResult",
      },
      type: "array",
      title: "Results",
    },
  },
  type: "object",
  title: "WorkflowExecutionBulkResetResponse",
} as const

export const $WorkflowExecutionCollectionPageItem = {
  properties: {
    index: {
      type: "integer",
      minimum: 0,
      title: "Index",
      description: "Collection index for this item",
    },
    kind: {
      $ref: "#/components/schemas/WorkflowExecutionCollectionPageItemKind",
      description: "Descriptor type for this collection page item",
    },
    stored: {
      anyOf: [
        {
          oneOf: [
            {
              $ref: "#/components/schemas/InlineObject",
            },
            {
              $ref: "#/components/schemas/ExternalObject",
            },
            {
              $ref: "#/components/schemas/CollectionObject",
            },
          ],
          discriminator: {
            propertyName: "type",
            mapping: {
              collection: "#/components/schemas/CollectionObject",
              external: "#/components/schemas/ExternalObject",
              inline: "#/components/schemas/InlineObject",
            },
          },
        },
        {
          type: "null",
        },
      ],
      title: "Stored",
      description: "StoredObject descriptor when kind is stored_object_ref",
    },
    value_preview: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Value Preview",
      description:
        "UTF-8 preview of serialized inline value when kind is inline_value",
    },
    value_size_bytes: {
      anyOf: [
        {
          type: "integer",
          minimum: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Value Size Bytes",
      description:
        "Serialized inline value size in bytes when kind is inline_value",
    },
    truncated: {
      type: "boolean",
      title: "Truncated",
      description: "Whether value_preview was truncated",
      default: false,
    },
  },
  type: "object",
  required: ["index", "kind"],
  title: "WorkflowExecutionCollectionPageItem",
} as const

export const $WorkflowExecutionCollectionPageItemKind = {
  type: "string",
  enum: ["stored_object_ref", "inline_value"],
  title: "WorkflowExecutionCollectionPageItemKind",
} as const

export const $WorkflowExecutionCollectionPageRequest = {
  properties: {
    event_id: {
      type: "integer",
      minimum: 1,
      title: "Event Id",
      description: "Temporal history event ID",
    },
    field: {
      $ref: "#/components/schemas/WorkflowExecutionObjectField",
      default: "action_result",
    },
    offset: {
      type: "integer",
      minimum: 0,
      title: "Offset",
      description: "Page start index (0-indexed)",
      default: 0,
    },
    limit: {
      type: "integer",
      maximum: 100,
      minimum: 1,
      title: "Limit",
      description: "Maximum number of items to return",
      default: 25,
    },
  },
  type: "object",
  required: ["event_id"],
  title: "WorkflowExecutionCollectionPageRequest",
} as const

export const $WorkflowExecutionCollectionPageResponse = {
  properties: {
    collection: {
      $ref: "#/components/schemas/CollectionObject",
      description: "Collection metadata for the requested result",
    },
    offset: {
      type: "integer",
      minimum: 0,
      title: "Offset",
      description: "Requested page offset",
    },
    limit: {
      type: "integer",
      minimum: 1,
      title: "Limit",
      description: "Requested page size",
    },
    next_offset: {
      anyOf: [
        {
          type: "integer",
          minimum: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Next Offset",
      description: "Offset to use for next page, or null if no more items",
    },
    items: {
      items: {
        $ref: "#/components/schemas/WorkflowExecutionCollectionPageItem",
      },
      type: "array",
      title: "Items",
      description: "Collection page descriptors",
    },
  },
  type: "object",
  required: ["collection", "offset", "limit"],
  title: "WorkflowExecutionCollectionPageResponse",
} as const

export const $WorkflowExecutionCreate = {
  properties: {
    workflow_id: {
      anyOf: [
        {
          type: "string",
          pattern: "wf_[0-9a-zA-Z]+",
        },
        {
          type: "string",
          pattern: "wf-[0-9a-f]{32}",
        },
      ],
      title: "Workflow Id",
    },
    inputs: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Inputs",
    },
    time_anchor: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Time Anchor",
      description:
        "Override the workflow's time anchor for FN.now() and related functions. If not provided, computed from TemporalScheduledStartTime (for schedules) or workflow start_time (for other triggers).",
    },
  },
  type: "object",
  required: ["workflow_id"],
  title: "WorkflowExecutionCreate",
} as const

export const $WorkflowExecutionCreateResponse = {
  properties: {
    message: {
      type: "string",
      title: "Message",
    },
    wf_id: {
      type: "string",
      title: "Wf Id",
    },
    wf_exec_id: {
      type: "string",
      pattern:
        "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      title: "Wf Exec Id",
    },
    payload: {
      title: "Payload",
    },
  },
  type: "object",
  required: ["message", "wf_id", "wf_exec_id"],
  title: "WorkflowExecutionCreateResponse",
} as const

export const $WorkflowExecutionEvent = {
  properties: {
    event_id: {
      type: "integer",
      title: "Event Id",
    },
    event_time: {
      type: "string",
      format: "date-time",
      title: "Event Time",
    },
    event_type: {
      $ref: "#/components/schemas/WorkflowEventType",
    },
    task_id: {
      type: "integer",
      title: "Task Id",
    },
    event_group: {
      anyOf: [
        {
          $ref: "#/components/schemas/EventGroup_TypeVar_",
        },
        {
          type: "null",
        },
      ],
      description:
        "The action group of the event. We use this to keep track of what events are related to each other.",
    },
    failure: {
      anyOf: [
        {
          $ref: "#/components/schemas/EventFailure",
        },
        {
          type: "null",
        },
      ],
    },
    result: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Result",
    },
    role: {
      anyOf: [
        {
          $ref: "#/components/schemas/Role",
        },
        {
          type: "null",
        },
      ],
    },
    parent_wf_exec_id: {
      anyOf: [
        {
          type: "string",
          pattern:
            "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Wf Exec Id",
    },
    workflow_timeout: {
      anyOf: [
        {
          type: "number",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Timeout",
    },
  },
  type: "object",
  required: ["event_id", "event_time", "event_type", "task_id"],
  title: "WorkflowExecutionEvent",
} as const

export const $WorkflowExecutionEventCompact_Any__Union_AgentOutput__Any___Any_ =
  {
    properties: {
      source_event_id: {
        type: "integer",
        title: "Source Event Id",
      },
      schedule_time: {
        type: "string",
        format: "date-time",
        title: "Schedule Time",
      },
      start_time: {
        anyOf: [
          {
            type: "string",
            format: "date-time",
          },
          {
            type: "null",
          },
        ],
        title: "Start Time",
      },
      close_time: {
        anyOf: [
          {
            type: "string",
            format: "date-time",
          },
          {
            type: "null",
          },
        ],
        title: "Close Time",
      },
      curr_event_type: {
        $ref: "#/components/schemas/WorkflowEventType",
      },
      status: {
        $ref: "#/components/schemas/WorkflowExecutionEventStatus",
      },
      action_name: {
        type: "string",
        title: "Action Name",
      },
      action_ref: {
        type: "string",
        title: "Action Ref",
      },
      action_input: {
        title: "Action Input",
      },
      action_result: {
        anyOf: [
          {
            $ref: "#/components/schemas/AgentOutput",
          },
          {},
          {
            type: "null",
          },
        ],
        title: "Action Result",
      },
      action_error: {
        anyOf: [
          {
            $ref: "#/components/schemas/EventFailure",
          },
          {
            type: "null",
          },
        ],
      },
      stream_id: {
        type: "string",
        title: "Stream Id",
        default: "<root>:0",
      },
      child_wf_exec_id: {
        anyOf: [
          {
            type: "string",
            pattern:
              "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
          },
          {
            type: "null",
          },
        ],
        title: "Child Wf Exec Id",
      },
      child_wf_count: {
        type: "integer",
        title: "Child Wf Count",
        default: 0,
      },
      loop_index: {
        anyOf: [
          {
            type: "integer",
          },
          {
            type: "null",
          },
        ],
        title: "Loop Index",
      },
      while_iteration: {
        anyOf: [
          {
            type: "integer",
          },
          {
            type: "null",
          },
        ],
        title: "While Iteration",
      },
      while_continue: {
        anyOf: [
          {
            type: "boolean",
          },
          {
            type: "null",
          },
        ],
        title: "While Continue",
      },
      child_wf_wait_strategy: {
        anyOf: [
          {
            $ref: "#/components/schemas/WaitStrategy",
          },
          {
            type: "null",
          },
        ],
      },
      session: {
        anyOf: [
          {
            $ref: "#/components/schemas/Session_Any_",
          },
          {
            type: "null",
          },
        ],
      },
    },
    type: "object",
    required: [
      "source_event_id",
      "schedule_time",
      "curr_event_type",
      "status",
      "action_name",
      "action_ref",
    ],
    title: "WorkflowExecutionEventCompact[Any, Union[AgentOutput, Any], Any]",
  } as const

export const $WorkflowExecutionEventStatus = {
  type: "string",
  enum: [
    "SCHEDULED",
    "STARTED",
    "COMPLETED",
    "FAILED",
    "CANCELED",
    "TERMINATED",
    "TIMED_OUT",
    "UNKNOWN",
    "DETACHED",
  ],
  title: "WorkflowExecutionEventStatus",
} as const

export const $WorkflowExecutionObjectDownloadResponse = {
  properties: {
    download_url: {
      type: "string",
      title: "Download Url",
      description: "Pre-signed download URL",
    },
    file_name: {
      type: "string",
      title: "File Name",
      description: "Suggested file name",
    },
    content_type: {
      type: "string",
      title: "Content Type",
      description: "MIME type of the object",
    },
    size_bytes: {
      type: "integer",
      minimum: 0,
      title: "Size Bytes",
      description: "Object size in bytes",
    },
    expires_in_seconds: {
      type: "integer",
      minimum: 1,
      title: "Expires In Seconds",
      description: "Presigned URL expiry in seconds",
    },
  },
  type: "object",
  required: [
    "download_url",
    "file_name",
    "content_type",
    "size_bytes",
    "expires_in_seconds",
  ],
  title: "WorkflowExecutionObjectDownloadResponse",
} as const

export const $WorkflowExecutionObjectField = {
  type: "string",
  enum: ["action_result"],
  title: "WorkflowExecutionObjectField",
} as const

export const $WorkflowExecutionObjectPreviewResponse = {
  properties: {
    content: {
      type: "string",
      title: "Content",
      description: "Preview text content",
    },
    content_type: {
      type: "string",
      title: "Content Type",
      description: "MIME type of the object",
    },
    size_bytes: {
      type: "integer",
      minimum: 0,
      title: "Size Bytes",
      description: "Total object size in bytes",
    },
    preview_bytes: {
      type: "integer",
      minimum: 0,
      title: "Preview Bytes",
      description: "Number of bytes used for preview",
    },
    truncated: {
      type: "boolean",
      title: "Truncated",
      description: "Whether preview is truncated due to size limits",
    },
    encoding: {
      type: "string",
      enum: ["utf-8", "unknown"],
      title: "Encoding",
      description: "Encoding used to decode preview text",
    },
  },
  type: "object",
  required: [
    "content",
    "content_type",
    "size_bytes",
    "preview_bytes",
    "truncated",
    "encoding",
  ],
  title: "WorkflowExecutionObjectPreviewResponse",
} as const

export const $WorkflowExecutionObjectRequest = {
  properties: {
    event_id: {
      type: "integer",
      minimum: 1,
      title: "Event Id",
      description: "Temporal history event ID",
    },
    field: {
      $ref: "#/components/schemas/WorkflowExecutionObjectField",
      default: "action_result",
    },
    collection_index: {
      anyOf: [
        {
          type: "integer",
          minimum: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Collection Index",
      description:
        "Optional index into a CollectionObject result. When omitted, operates on the top-level object result.",
    },
  },
  type: "object",
  required: ["event_id"],
  title: "WorkflowExecutionObjectRequest",
} as const

export const $WorkflowExecutionRead = {
  properties: {
    id: {
      type: "string",
      title: "Id",
      description: "The ID of the workflow execution",
    },
    run_id: {
      type: "string",
      title: "Run Id",
      description: "The run ID of the workflow execution",
    },
    start_time: {
      type: "string",
      format: "date-time",
      title: "Start Time",
      description: "The start time of the workflow execution",
    },
    execution_time: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Execution Time",
      description: "When this workflow run started or should start.",
    },
    close_time: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Close Time",
      description: "When the workflow was closed if closed.",
    },
    status: {
      type: "string",
      enum: [
        "RUNNING",
        "COMPLETED",
        "FAILED",
        "CANCELED",
        "TERMINATED",
        "CONTINUED_AS_NEW",
        "TIMED_OUT",
      ],
    },
    workflow_type: {
      type: "string",
      title: "Workflow Type",
    },
    task_queue: {
      type: "string",
      title: "Task Queue",
    },
    history_length: {
      type: "integer",
      title: "History Length",
      description: "Number of events in the history",
    },
    parent_wf_exec_id: {
      anyOf: [
        {
          type: "string",
          pattern:
            "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Wf Exec Id",
    },
    trigger_type: {
      $ref: "#/components/schemas/TriggerType",
    },
    execution_type: {
      $ref: "#/components/schemas/ExecutionType",
      description:
        "Execution type (draft or published). Draft uses the draft workflow graph.",
      default: "published",
    },
    events: {
      items: {
        $ref: "#/components/schemas/WorkflowExecutionEvent",
      },
      type: "array",
      title: "Events",
      description: "The events in the workflow execution",
    },
    interactions: {
      items: {
        $ref: "#/components/schemas/InteractionRead",
      },
      type: "array",
      title: "Interactions",
      description: "The interactions in the workflow execution",
    },
  },
  type: "object",
  required: [
    "id",
    "run_id",
    "start_time",
    "status",
    "workflow_type",
    "task_queue",
    "history_length",
    "trigger_type",
    "events",
  ],
  title: "WorkflowExecutionRead",
} as const

export const $WorkflowExecutionReadCompact_Any__Union_AgentOutput__Any___Any_ =
  {
    properties: {
      id: {
        type: "string",
        title: "Id",
        description: "The ID of the workflow execution",
      },
      run_id: {
        type: "string",
        title: "Run Id",
        description: "The run ID of the workflow execution",
      },
      start_time: {
        type: "string",
        format: "date-time",
        title: "Start Time",
        description: "The start time of the workflow execution",
      },
      execution_time: {
        anyOf: [
          {
            type: "string",
            format: "date-time",
          },
          {
            type: "null",
          },
        ],
        title: "Execution Time",
        description: "When this workflow run started or should start.",
      },
      close_time: {
        anyOf: [
          {
            type: "string",
            format: "date-time",
          },
          {
            type: "null",
          },
        ],
        title: "Close Time",
        description: "When the workflow was closed if closed.",
      },
      status: {
        type: "string",
        enum: [
          "RUNNING",
          "COMPLETED",
          "FAILED",
          "CANCELED",
          "TERMINATED",
          "CONTINUED_AS_NEW",
          "TIMED_OUT",
        ],
      },
      workflow_type: {
        type: "string",
        title: "Workflow Type",
      },
      task_queue: {
        type: "string",
        title: "Task Queue",
      },
      history_length: {
        type: "integer",
        title: "History Length",
        description: "Number of events in the history",
      },
      parent_wf_exec_id: {
        anyOf: [
          {
            type: "string",
            pattern:
              "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
          },
          {
            type: "null",
          },
        ],
        title: "Parent Wf Exec Id",
      },
      trigger_type: {
        $ref: "#/components/schemas/TriggerType",
      },
      execution_type: {
        $ref: "#/components/schemas/ExecutionType",
        description:
          "Execution type (draft or published). Draft uses the draft workflow graph.",
        default: "published",
      },
      events: {
        items: {
          $ref: "#/components/schemas/WorkflowExecutionEventCompact_Any__Union_AgentOutput__Any___Any_",
        },
        type: "array",
        title: "Events",
        description: "Compact events in the workflow execution",
      },
      interactions: {
        items: {
          $ref: "#/components/schemas/InteractionRead",
        },
        type: "array",
        title: "Interactions",
        description: "The interactions in the workflow execution",
      },
    },
    type: "object",
    required: [
      "id",
      "run_id",
      "start_time",
      "status",
      "workflow_type",
      "task_queue",
      "history_length",
      "trigger_type",
      "events",
    ],
    title: "WorkflowExecutionReadCompact[Any, Union[AgentOutput, Any], Any]",
  } as const

export const $WorkflowExecutionReadMinimal = {
  properties: {
    id: {
      type: "string",
      title: "Id",
      description: "The ID of the workflow execution",
    },
    run_id: {
      type: "string",
      title: "Run Id",
      description: "The run ID of the workflow execution",
    },
    start_time: {
      type: "string",
      format: "date-time",
      title: "Start Time",
      description: "The start time of the workflow execution",
    },
    execution_time: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Execution Time",
      description: "When this workflow run started or should start.",
    },
    close_time: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Close Time",
      description: "When the workflow was closed if closed.",
    },
    status: {
      type: "string",
      enum: [
        "RUNNING",
        "COMPLETED",
        "FAILED",
        "CANCELED",
        "TERMINATED",
        "CONTINUED_AS_NEW",
        "TIMED_OUT",
      ],
    },
    workflow_type: {
      type: "string",
      title: "Workflow Type",
    },
    task_queue: {
      type: "string",
      title: "Task Queue",
    },
    history_length: {
      type: "integer",
      title: "History Length",
      description: "Number of events in the history",
    },
    parent_wf_exec_id: {
      anyOf: [
        {
          type: "string",
          pattern:
            "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Wf Exec Id",
    },
    trigger_type: {
      $ref: "#/components/schemas/TriggerType",
    },
    execution_type: {
      $ref: "#/components/schemas/ExecutionType",
      description:
        "Execution type (draft or published). Draft uses the draft workflow graph.",
      default: "published",
    },
  },
  type: "object",
  required: [
    "id",
    "run_id",
    "start_time",
    "status",
    "workflow_type",
    "task_queue",
    "history_length",
    "trigger_type",
  ],
  title: "WorkflowExecutionReadMinimal",
} as const

export const $WorkflowExecutionRelationFilter = {
  type: "string",
  enum: ["all", "root", "child"],
  title: "WorkflowExecutionRelationFilter",
} as const

export const $WorkflowExecutionResetPointRead = {
  properties: {
    event_id: {
      type: "integer",
      minimum: 1,
      title: "Event Id",
    },
    event_time: {
      type: "string",
      format: "date-time",
      title: "Event Time",
    },
    event_type: {
      type: "string",
      title: "Event Type",
    },
    label: {
      type: "string",
      title: "Label",
    },
    is_start: {
      type: "boolean",
      title: "Is Start",
      description:
        "True when this point maps to the earliest resettable point.",
      default: false,
    },
    is_resettable: {
      type: "boolean",
      title: "Is Resettable",
      description: "Whether the event can be used directly as a reset target.",
      default: false,
    },
  },
  type: "object",
  required: ["event_id", "event_time", "event_type", "label"],
  title: "WorkflowExecutionResetPointRead",
} as const

export const $WorkflowExecutionResetReapplyType = {
  type: "string",
  enum: ["all_eligible", "signal_only", "none"],
  title: "WorkflowExecutionResetReapplyType",
} as const

export const $WorkflowExecutionResetRequest = {
  properties: {
    event_id: {
      anyOf: [
        {
          type: "integer",
          minimum: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Event Id",
      description:
        "Temporal history event id to reset from. If omitted, reset uses start.",
    },
    reason: {
      anyOf: [
        {
          type: "string",
          maxLength: 1024,
        },
        {
          type: "null",
        },
      ],
      title: "Reason",
    },
    reapply_type: {
      $ref: "#/components/schemas/WorkflowExecutionResetReapplyType",
      default: "all_eligible",
    },
  },
  type: "object",
  title: "WorkflowExecutionResetRequest",
} as const

export const $WorkflowExecutionResetResponse = {
  properties: {
    execution_id: {
      type: "string",
      pattern:
        "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
      title: "Execution Id",
    },
    new_run_id: {
      type: "string",
      title: "New Run Id",
    },
  },
  type: "object",
  required: ["execution_id", "new_run_id"],
  title: "WorkflowExecutionResetResponse",
} as const

export const $WorkflowExecutionStatus = {
  type: "integer",
  enum: [1, 2, 3, 4, 5, 6, 7],
  title: "WorkflowExecutionStatus",
  description: `Status of a workflow execution.

See :py:class:\`temporalio.api.enums.v1.WorkflowExecutionStatus\`.`,
} as const

export const $WorkflowExecutionStatusFilterMode = {
  type: "string",
  enum: ["include", "exclude"],
  title: "WorkflowExecutionStatusFilterMode",
} as const

export const $WorkflowExecutionTerminate = {
  properties: {
    reason: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Reason",
    },
  },
  type: "object",
  title: "WorkflowExecutionTerminate",
} as const

export const $WorkflowFolderCreate = {
  properties: {
    name: {
      type: "string",
      title: "Name",
    },
    parent_path: {
      type: "string",
      title: "Parent Path",
      default: "/",
    },
  },
  type: "object",
  required: ["name"],
  title: "WorkflowFolderCreate",
} as const

export const $WorkflowFolderDelete = {
  properties: {
    recursive: {
      type: "boolean",
      title: "Recursive",
      default: false,
    },
  },
  type: "object",
  title: "WorkflowFolderDelete",
} as const

export const $WorkflowFolderMove = {
  properties: {
    new_parent_path: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "New Parent Path",
    },
  },
  type: "object",
  title: "WorkflowFolderMove",
} as const

export const $WorkflowFolderRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    path: {
      type: "string",
      title: "Path",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: ["id", "name", "path", "workspace_id", "created_at", "updated_at"],
  title: "WorkflowFolderRead",
} as const

export const $WorkflowFolderUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
  },
  type: "object",
  title: "WorkflowFolderUpdate",
} as const

export const $WorkflowMoveToFolder = {
  properties: {
    folder_path: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Folder Path",
    },
  },
  type: "object",
  title: "WorkflowMoveToFolder",
} as const

export const $WorkflowRead = {
  properties: {
    id: {
      type: "string",
      pattern: "wf_[0-9a-zA-Z]+",
      title: "Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    description: {
      type: "string",
      title: "Description",
    },
    status: {
      type: "string",
      title: "Status",
    },
    actions: {
      additionalProperties: {
        $ref: "#/components/schemas/ActionRead",
      },
      type: "object",
      title: "Actions",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    version: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Version",
    },
    webhook: {
      $ref: "#/components/schemas/WebhookRead",
    },
    schedules: {
      items: {
        $ref: "#/components/schemas/ScheduleRead",
      },
      type: "array",
      title: "Schedules",
    },
    entrypoint: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Entrypoint",
    },
    expects: {
      anyOf: [
        {
          additionalProperties: {
            $ref: "#/components/schemas/ExpectedField-Output",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Expects",
    },
    expects_schema: {
      anyOf: [
        {
          additionalProperties: true,
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Expects Schema",
    },
    returns: {
      title: "Returns",
    },
    config: {
      anyOf: [
        {
          $ref: "#/components/schemas/DSLConfig-Output",
        },
        {
          type: "null",
        },
      ],
    },
    alias: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Alias",
    },
    git_sync_branch: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Sync Branch",
    },
    error_handler: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error Handler",
    },
    trigger_position_x: {
      type: "number",
      title: "Trigger Position X",
      default: 0,
    },
    trigger_position_y: {
      type: "number",
      title: "Trigger Position Y",
      default: 0,
    },
    graph_version: {
      type: "integer",
      title: "Graph Version",
      default: 1,
    },
  },
  type: "object",
  required: [
    "id",
    "title",
    "description",
    "status",
    "actions",
    "workspace_id",
    "webhook",
    "schedules",
    "entrypoint",
    "returns",
    "config",
  ],
  title: "WorkflowRead",
} as const

export const $WorkflowReadMinimal = {
  properties: {
    id: {
      type: "string",
      pattern: "wf_[0-9a-zA-Z]+",
      title: "Id",
    },
    title: {
      type: "string",
      title: "Title",
    },
    description: {
      type: "string",
      title: "Description",
    },
    status: {
      type: "string",
      title: "Status",
    },
    icon_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Icon Url",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
    version: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Version",
    },
    tags: {
      anyOf: [
        {
          items: {
            $ref: "#/components/schemas/TagRead",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Tags",
    },
    alias: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Alias",
    },
    error_handler: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error Handler",
    },
    latest_definition: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkflowDefinitionReadMinimal",
        },
        {
          type: "null",
        },
      ],
    },
    folder_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Folder Id",
    },
    trigger_summary: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkflowTriggerSummary",
        },
        {
          type: "null",
        },
      ],
    },
  },
  type: "object",
  required: [
    "id",
    "title",
    "description",
    "status",
    "icon_url",
    "created_at",
    "updated_at",
    "version",
  ],
  title: "WorkflowReadMinimal",
  description: "Minimal version of WorkflowRead model for list endpoints.",
} as const

export const $WorkflowRunReadMinimal = {
  properties: {
    id: {
      type: "string",
      title: "Id",
      description: "The ID of the workflow execution",
    },
    run_id: {
      type: "string",
      title: "Run Id",
      description: "The run ID of the workflow execution",
    },
    start_time: {
      type: "string",
      format: "date-time",
      title: "Start Time",
      description: "The start time of the workflow execution",
    },
    execution_time: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Execution Time",
      description: "When this workflow run started or should start.",
    },
    close_time: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Close Time",
      description: "When the workflow was closed if closed.",
    },
    status: {
      type: "string",
      enum: [
        "RUNNING",
        "COMPLETED",
        "FAILED",
        "CANCELED",
        "TERMINATED",
        "CONTINUED_AS_NEW",
        "TIMED_OUT",
      ],
    },
    workflow_type: {
      type: "string",
      title: "Workflow Type",
    },
    task_queue: {
      type: "string",
      title: "Task Queue",
    },
    history_length: {
      type: "integer",
      title: "History Length",
      description: "Number of events in the history",
    },
    parent_wf_exec_id: {
      anyOf: [
        {
          type: "string",
          pattern:
            "(?P<workflow_id>wf-[0-9a-f]{32}|wf_[0-9a-zA-Z]+)[:/](?P<execution_id>(exec_[0-9a-zA-Z]+|exec-[\\w-]+|(?:sch-[0-9a-f]{32}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})-.*))",
        },
        {
          type: "null",
        },
      ],
      title: "Parent Wf Exec Id",
    },
    trigger_type: {
      $ref: "#/components/schemas/TriggerType",
    },
    execution_type: {
      $ref: "#/components/schemas/ExecutionType",
      description:
        "Execution type (draft or published). Draft uses the draft workflow graph.",
      default: "published",
    },
    workflow_id: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Id",
      description: "Short workflow ID parsed from workflow execution ID.",
    },
    workflow_title: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Title",
      description: "Workflow title from workspace metadata when available.",
    },
    workflow_alias: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Alias",
      description:
        "Workflow alias from workspace metadata or execution search attributes.",
    },
  },
  type: "object",
  required: [
    "id",
    "run_id",
    "start_time",
    "status",
    "workflow_type",
    "task_queue",
    "history_length",
    "trigger_type",
  ],
  title: "WorkflowRunReadMinimal",
} as const

export const $WorkflowSummary = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
      description: "Workflow ID",
    },
    title: {
      type: "string",
      title: "Title",
      description: "Workflow title",
    },
    alias: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Alias",
      description: "Workflow alias",
    },
  },
  type: "object",
  required: ["id", "title"],
  title: "WorkflowSummary",
  description: "Summary of a workflow for inbox item context.",
} as const

export const $WorkflowSyncPullRequest = {
  properties: {
    commit_sha: {
      type: "string",
      maxLength: 64,
      minLength: 40,
      title: "Commit Sha",
      description: "Specific commit SHA to pull from",
    },
    dry_run: {
      type: "boolean",
      title: "Dry Run",
      description: "Validate only, don't perform actual import",
      default: false,
    },
  },
  type: "object",
  required: ["commit_sha"],
  title: "WorkflowSyncPullRequest",
  description: "Request model for pulling workflows from a Git repository.",
} as const

export const $WorkflowTagCreate = {
  properties: {
    tag_id: {
      type: "string",
      format: "uuid",
      title: "Tag Id",
    },
  },
  type: "object",
  required: ["tag_id"],
  title: "WorkflowTagCreate",
} as const

export const $WorkflowTriggerSummary = {
  properties: {
    schedule_count_online: {
      type: "integer",
      title: "Schedule Count Online",
      default: 0,
    },
    schedule_cron: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Schedule Cron",
    },
    schedule_natural: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Schedule Natural",
    },
    webhook_active: {
      type: "boolean",
      title: "Webhook Active",
      default: false,
    },
    case_trigger_events: {
      items: {
        $ref: "#/components/schemas/CaseEventType",
      },
      type: "array",
      title: "Case Trigger Events",
    },
  },
  type: "object",
  title: "WorkflowTriggerSummary",
} as const

export const $WorkflowUpdate = {
  properties: {
    title: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 3,
        },
        {
          type: "null",
        },
      ],
      title: "Title",
      description: "Workflow title, between 3 and 100 characters",
    },
    description: {
      anyOf: [
        {
          type: "string",
          maxLength: 1000,
        },
        {
          type: "null",
        },
      ],
      title: "Description",
      description: "Optional workflow description, up to 1000 characters",
    },
    status: {
      anyOf: [
        {
          type: "string",
          enum: ["online", "offline"],
        },
        {
          type: "null",
        },
      ],
      title: "Status",
    },
    version: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Version",
    },
    entrypoint: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Entrypoint",
    },
    icon_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Icon Url",
    },
    expects: {
      anyOf: [
        {
          additionalProperties: {
            $ref: "#/components/schemas/ExpectedField-Input",
          },
          type: "object",
        },
        {
          type: "null",
        },
      ],
      title: "Expects",
    },
    returns: {
      anyOf: [
        {},
        {
          type: "null",
        },
      ],
      title: "Returns",
    },
    config: {
      anyOf: [
        {
          $ref: "#/components/schemas/DSLConfig-Input",
        },
        {
          type: "null",
        },
      ],
    },
    alias: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Alias",
    },
    error_handler: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Error Handler",
    },
  },
  type: "object",
  title: "WorkflowUpdate",
} as const

export const $WorkspaceCreate = {
  properties: {
    name: {
      type: "string",
      maxLength: 100,
      minLength: 1,
      title: "Name",
    },
    settings: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkspaceSettingsUpdate",
        },
        {
          type: "null",
        },
      ],
    },
    organization_id: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Organization Id",
    },
  },
  type: "object",
  required: ["name"],
  title: "WorkspaceCreate",
} as const

export const $WorkspaceInvitationCreate = {
  properties: {
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_id: {
      type: "string",
      title: "Role Id",
    },
  },
  type: "object",
  required: ["email", "role_id"],
  title: "WorkspaceInvitationCreate",
  description: "Request schema for creating a workspace invitation.",
} as const

export const $WorkspaceInvitationRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_id: {
      type: "string",
      title: "Role Id",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
    role_slug: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Role Slug",
    },
    status: {
      $ref: "#/components/schemas/InvitationStatus",
    },
    invited_by: {
      anyOf: [
        {
          type: "string",
          format: "uuid",
        },
        {
          type: "null",
        },
      ],
      title: "Invited By",
    },
    expires_at: {
      type: "string",
      format: "date-time",
      title: "Expires At",
    },
    accepted_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Accepted At",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
  },
  type: "object",
  required: [
    "id",
    "workspace_id",
    "email",
    "role_id",
    "role_name",
    "status",
    "invited_by",
    "expires_at",
    "accepted_at",
    "created_at",
  ],
  title: "WorkspaceInvitationRead",
  description: "Response schema for a workspace invitation.",
} as const

export const $WorkspaceMember = {
  properties: {
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
    },
    first_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "First Name",
    },
    last_name: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Last Name",
    },
    email: {
      type: "string",
      format: "email",
      title: "Email",
    },
    role_name: {
      type: "string",
      title: "Role Name",
    },
  },
  type: "object",
  required: ["user_id", "first_name", "last_name", "email", "role_name"],
  title: "WorkspaceMember",
} as const

export const $WorkspaceMembershipCreate = {
  properties: {
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
    },
  },
  type: "object",
  required: ["user_id"],
  title: "WorkspaceMembershipCreate",
} as const

export const $WorkspaceMembershipRead = {
  properties: {
    user_id: {
      type: "string",
      format: "uuid",
      title: "User Id",
    },
    workspace_id: {
      type: "string",
      format: "uuid",
      title: "Workspace Id",
    },
  },
  type: "object",
  required: ["user_id", "workspace_id"],
  title: "WorkspaceMembershipRead",
} as const

export const $WorkspaceRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    settings: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkspaceSettingsRead",
        },
        {
          type: "null",
        },
      ],
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
  },
  type: "object",
  required: ["id", "name", "organization_id"],
  title: "WorkspaceRead",
} as const

export const $WorkspaceReadMinimal = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
  },
  type: "object",
  required: ["id", "name"],
  title: "WorkspaceReadMinimal",
} as const

export const $WorkspaceSettingsRead = {
  properties: {
    git_repo_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Url",
    },
    workflow_unlimited_timeout_enabled: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Unlimited Timeout Enabled",
    },
    workflow_default_timeout_seconds: {
      anyOf: [
        {
          type: "integer",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Default Timeout Seconds",
    },
    allowed_attachment_extensions: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Allowed Attachment Extensions",
    },
    allowed_attachment_mime_types: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Allowed Attachment Mime Types",
    },
    validate_attachment_magic_number: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Validate Attachment Magic Number",
    },
    effective_allowed_attachment_extensions: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Effective Allowed Attachment Extensions",
      description:
        "Returns workspace-specific extensions if set, otherwise system defaults.",
      readOnly: true,
    },
    effective_allowed_attachment_mime_types: {
      items: {
        type: "string",
      },
      type: "array",
      title: "Effective Allowed Attachment Mime Types",
      description:
        "Returns workspace-specific MIME types if set, otherwise system defaults.",
      readOnly: true,
    },
  },
  type: "object",
  required: [
    "effective_allowed_attachment_extensions",
    "effective_allowed_attachment_mime_types",
  ],
  title: "WorkspaceSettingsRead",
} as const

export const $WorkspaceSettingsUpdate = {
  properties: {
    git_repo_url: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Git Repo Url",
    },
    workflow_unlimited_timeout_enabled: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Unlimited Timeout Enabled",
      description:
        "Allow workflows to run indefinitely without timeout constraints. When enabled, individual workflow timeout settings are ignored.",
    },
    workflow_default_timeout_seconds: {
      anyOf: [
        {
          type: "integer",
          minimum: 0,
        },
        {
          type: "null",
        },
      ],
      title: "Workflow Default Timeout Seconds",
      description:
        "Default timeout in seconds for workflows in this workspace. Must be greater than or equal to 0.",
    },
    allowed_attachment_extensions: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Allowed Attachment Extensions",
      description:
        "Allowed file extensions for attachments (e.g., ['.pdf', '.docx']). Overrides global defaults.",
    },
    allowed_attachment_mime_types: {
      anyOf: [
        {
          items: {
            type: "string",
          },
          type: "array",
        },
        {
          type: "null",
        },
      ],
      title: "Allowed Attachment Mime Types",
      description:
        "Allowed MIME types for attachments (e.g., ['application/pdf', 'image/jpeg']). Overrides global defaults.",
    },
    validate_attachment_magic_number: {
      anyOf: [
        {
          type: "boolean",
        },
        {
          type: "null",
        },
      ],
      title: "Validate Attachment Magic Number",
      description:
        "Whether to validate file content matches declared MIME type using magic number detection. Defaults to true for security.",
    },
  },
  type: "object",
  title: "WorkspaceSettingsUpdate",
} as const

export const $WorkspaceUpdate = {
  properties: {
    name: {
      anyOf: [
        {
          type: "string",
          maxLength: 100,
          minLength: 1,
        },
        {
          type: "null",
        },
      ],
      title: "Name",
    },
    settings: {
      anyOf: [
        {
          $ref: "#/components/schemas/WorkspaceSettingsUpdate",
        },
        {
          type: "null",
        },
      ],
    },
  },
  type: "object",
  title: "WorkspaceUpdate",
} as const

export const $Yaml = {
  properties: {
    component_id: {
      type: "string",
      const: "yaml",
      title: "Component Id",
      default: "yaml",
    },
  },
  type: "object",
  title: "Yaml",
} as const

export const $tracecat__admin__registry__schemas__RegistrySyncResponse = {
  properties: {
    success: {
      type: "boolean",
      title: "Success",
    },
    synced_at: {
      type: "string",
      format: "date-time",
      title: "Synced At",
    },
    repositories: {
      items: {
        $ref: "#/components/schemas/RepositorySyncResult",
      },
      type: "array",
      title: "Repositories",
    },
  },
  type: "object",
  required: ["success", "synced_at", "repositories"],
  title: "RegistrySyncResponse",
  description: "Response from sync operation.",
} as const

export const $tracecat__admin__registry__schemas__RegistryVersionPromoteResponse =
  {
    properties: {
      repository_id: {
        type: "string",
        format: "uuid",
        title: "Repository Id",
      },
      origin: {
        type: "string",
        title: "Origin",
      },
      previous_version_id: {
        anyOf: [
          {
            type: "string",
            format: "uuid",
          },
          {
            type: "null",
          },
        ],
        title: "Previous Version Id",
      },
      current_version_id: {
        type: "string",
        format: "uuid",
        title: "Current Version Id",
      },
      version: {
        type: "string",
        title: "Version",
      },
    },
    type: "object",
    required: [
      "repository_id",
      "origin",
      "previous_version_id",
      "current_version_id",
      "version",
    ],
    title: "RegistryVersionPromoteResponse",
    description: "Response from promoting a registry version.",
  } as const

export const $tracecat__admin__registry__schemas__RegistryVersionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    repository_id: {
      type: "string",
      format: "uuid",
      title: "Repository Id",
    },
    version: {
      type: "string",
      title: "Version",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    tarball_uri: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Tarball Uri",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    is_current: {
      type: "boolean",
      title: "Is Current",
      default: false,
    },
    artifacts_ready: {
      type: "boolean",
      title: "Artifacts Ready",
      default: false,
    },
    workflow_definition_count: {
      type: "integer",
      title: "Workflow Definition Count",
      default: 0,
    },
    in_use: {
      type: "boolean",
      title: "In Use",
      default: false,
    },
  },
  type: "object",
  required: [
    "id",
    "repository_id",
    "version",
    "commit_sha",
    "tarball_uri",
    "created_at",
  ],
  title: "RegistryVersionRead",
  description: "Registry version details.",
} as const

export const $tracecat__organization__schemas__OrgDomainRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    domain: {
      type: "string",
      title: "Domain",
    },
    normalized_domain: {
      type: "string",
      title: "Normalized Domain",
    },
    is_primary: {
      type: "boolean",
      title: "Is Primary",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
    },
    verified_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Verified At",
    },
    verification_method: {
      type: "string",
      title: "Verification Method",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "domain",
    "normalized_domain",
    "is_primary",
    "is_active",
    "verified_at",
    "verification_method",
    "created_at",
    "updated_at",
  ],
  title: "OrgDomainRead",
} as const

export const $tracecat__organization__schemas__OrgRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
  },
  type: "object",
  required: ["id", "name"],
  title: "OrgRead",
} as const

export const $tracecat__registry__repositories__schemas__RegistrySyncResponse =
  {
    properties: {
      success: {
        type: "boolean",
        title: "Success",
      },
      repository_id: {
        type: "string",
        format: "uuid",
        title: "Repository Id",
      },
      origin: {
        type: "string",
        title: "Origin",
      },
      version: {
        anyOf: [
          {
            type: "string",
          },
          {
            type: "null",
          },
        ],
        title: "Version",
      },
      commit_sha: {
        anyOf: [
          {
            type: "string",
          },
          {
            type: "null",
          },
        ],
        title: "Commit Sha",
      },
      actions_count: {
        anyOf: [
          {
            type: "integer",
          },
          {
            type: "null",
          },
        ],
        title: "Actions Count",
      },
      forced: {
        type: "boolean",
        title: "Forced",
        default: false,
      },
    },
    type: "object",
    required: ["success", "repository_id", "origin"],
    title: "RegistrySyncResponse",
    description: "Response model for registry sync operation.",
  } as const

export const $tracecat__registry__repositories__schemas__RegistryVersionPromoteResponse =
  {
    properties: {
      repository_id: {
        type: "string",
        format: "uuid",
        title: "Repository Id",
      },
      origin: {
        type: "string",
        title: "Origin",
      },
      previous_version_id: {
        anyOf: [
          {
            type: "string",
            format: "uuid",
          },
          {
            type: "null",
          },
        ],
        title: "Previous Version Id",
      },
      current_version_id: {
        type: "string",
        format: "uuid",
        title: "Current Version Id",
      },
      version: {
        type: "string",
        title: "Version",
      },
    },
    type: "object",
    required: [
      "repository_id",
      "origin",
      "previous_version_id",
      "current_version_id",
      "version",
    ],
    title: "RegistryVersionPromoteResponse",
    description: "Response model for version promotion.",
  } as const

export const $tracecat__registry__repositories__schemas__RegistryVersionRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    repository_id: {
      type: "string",
      format: "uuid",
      title: "Repository Id",
    },
    version: {
      type: "string",
      title: "Version",
    },
    commit_sha: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Commit Sha",
    },
    tarball_uri: {
      anyOf: [
        {
          type: "string",
        },
        {
          type: "null",
        },
      ],
      title: "Tarball Uri",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
  },
  type: "object",
  required: [
    "id",
    "repository_id",
    "version",
    "commit_sha",
    "tarball_uri",
    "created_at",
  ],
  title: "RegistryVersionRead",
  description: "Response model for reading a registry version.",
} as const

export const $tracecat_ee__admin__organizations__schemas__OrgDomainRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    organization_id: {
      type: "string",
      format: "uuid",
      title: "Organization Id",
    },
    domain: {
      type: "string",
      title: "Domain",
    },
    normalized_domain: {
      type: "string",
      title: "Normalized Domain",
    },
    is_primary: {
      type: "boolean",
      title: "Is Primary",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
    },
    verified_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Verified At",
    },
    verification_method: {
      type: "string",
      title: "Verification Method",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      type: "string",
      format: "date-time",
      title: "Updated At",
    },
  },
  type: "object",
  required: [
    "id",
    "organization_id",
    "domain",
    "normalized_domain",
    "is_primary",
    "is_active",
    "verification_method",
    "created_at",
    "updated_at",
  ],
  title: "OrgDomainRead",
  description: "Organization domain response.",
} as const

export const $tracecat_ee__admin__organizations__schemas__OrgRead = {
  properties: {
    id: {
      type: "string",
      format: "uuid",
      title: "Id",
    },
    name: {
      type: "string",
      title: "Name",
    },
    slug: {
      type: "string",
      title: "Slug",
    },
    is_active: {
      type: "boolean",
      title: "Is Active",
    },
    created_at: {
      type: "string",
      format: "date-time",
      title: "Created At",
    },
    updated_at: {
      anyOf: [
        {
          type: "string",
          format: "date-time",
        },
        {
          type: "null",
        },
      ],
      title: "Updated At",
    },
  },
  type: "object",
  required: ["id", "name", "slug", "is_active", "created_at"],
  title: "OrgRead",
  description: "Organization response.",
} as const
