# Copyright (C) 2026 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# generated by datamodel-codegen

from __future__ import annotations

from enum import Enum
from typing import Any

from pydantic import AnyUrl, AwareDatetime, BaseModel, ConfigDict, Field, conint


class AuthRedirectRequestBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )


class BinaryInfo(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    name: str | None = None
    platform: str | None = None
    size: int | None = None
    type: str | None = None


class BuildInfo(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    architecture: str | None = None
    branch: str | None = None
    go_version: str | None = None
    mode: str | None = None
    operating_system: str | None = None
    revision: str | None = None
    short_revision: str | None = None
    timestamp: str | None = None
    version: str | None = None
    version_hash: str | None = None


class CheckPermissionsResponse(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    allowed: bool | None = Field(default=None, description="Indicates if the check was successful")


class CompatBackend(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    name: str | None = None
    obj_type: str | None = None
    priority: int | None = None
    reference: str | None = None
    url: str | None = None
    use_default_url: bool | None = None


class CompatBuildInfo(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    branch: str | None = None
    revision: str | None = None
    short_revision: str | None = None
    timestamp: str | None = None
    version: str | None = None


class CompatCopyRequestBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    destination: str | None = None


class CompatCopyResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    checksum: str | None = None


class CompatHealthResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    ansft: bool | None = None
    build: CompatBuildInfo | None = None


class CompatStorageResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    backends: list[CompatBackend] | None = None


class CompatUploadResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    checksum: str | None = None


class DataAssignment(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    compressed_size: conint(ge=0) | None = None
    compression: str | None = None
    custom: dict[str, Any] | None = None
    uncompressed_size: conint(ge=0) | None = None


class Debug(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    panic_file: str | None = Field(default=None, description="Path to the panic file if panic logging is enabled")


class DetailedError(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    code: int | None = None
    errors: list[str] | None = None
    message: str | None = None


class ErrorDetail(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    location: str | None = Field(
        default=None,
        description="Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'",
    )
    message: str | None = Field(default=None, description="Error message text")
    value: Any | None = Field(default=None, description="The value at the given location")


class ErrorModel(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    detail: str | None = Field(
        default=None,
        description="A human-readable explanation specific to this occurrence of the problem.",
        examples=["Property foo is required but is missing."],
    )
    errors: list[ErrorDetail] | None = Field(default=None, description="Optional list of individual error details")
    instance: AnyUrl | None = Field(
        default=None,
        description="A URI reference that identifies the specific occurrence of the problem.",
        examples=["https://example.com/error-log/abc123"],
    )
    status: int | None = Field(default=None, description="HTTP status code", examples=[400])
    title: str | None = Field(
        default=None,
        description="A short, human-readable summary of the problem type. This value should not change between occurrences of the error.",
        examples=["Bad Request"],
    )
    type: AnyUrl | None = Field(
        default="about:blank",
        description="A URI reference to human-readable documentation for the error.",
        examples=["https://example.com/errors/example"],
    )


class Features(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    auth_types: list[str] | None = None
    compression_plugins: list[str] | None = None
    metadata_plugins: list[str] | None = None
    operation_plugins: list[str] | None = None
    permissions_plugins: list[str] | None = None
    storage_plugins: list[str] | None = None


class FileDownloadTokenResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    token: str | None = None


class ListBinariesResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    available: list[BinaryInfo] | None = None


class OperationIdResponse(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    id: str | None = Field(
        default=None,
        description="ID of the operation",
        examples=["2diK2kCkpgeHAQSNthIZ1JYyPte"],
    )
    location: str | None = Field(
        default=None,
        description="Location to poll for operation status, provided in the body for convenience",
        examples=["/api/v1/operations/2diK2kCkpgeHAQSNthIZ1JYyPte"],
    )


class OperationsRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    ids: list[str] | None = Field(default=None, description="List of operation IDs to retrieve")


class PlainSrcDst(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    dst: str | None = None
    src: str | None = None


class RemoveMetadataRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    paths: list[str] | None = Field(default=None, description="Paths to remove metadata for")
    recursive: bool | None = Field(default=None, description="Whether to remove metadata recursively")


class SetMetadataRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    metadata: dict[str, DataAssignment] | None = Field(default=None, description="Per-path metadata to set")


class StatusResponse(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    build_info: BuildInfo | None = Field(default=None, description="Information about the build")
    debug: Debug | None = Field(default=None, description="Debugging information")
    features: Features | None = Field(default=None, description="List of features and plugins available in the server")
    ready: bool | None = Field(default=None, description="Indicates if the server is ready to accept requests")
    time: str | None = Field(default=None, description="Current server time")


class StorageConfigResponse(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    storage: list[Any] | None = None


class StoragePath(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    path: str | None = Field(default=None, examples=["my/path/to/data"])
    remote: str | None = "any"


class TokenRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    other: dict[str, Any] | None = None
    read: list[str] | None = None
    recursive: bool | None = None
    type: str | None = None
    write: list[str] | None = None


class UserInfo(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    account_id: str | None = None
    groups: list[str] | None = None
    id: str | None = None
    is_admin: bool | None = None
    roles: list[str] | None = None
    service_admin: bool | None = None
    username: str | None = None


class WhoamiResponse(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    user: UserInfo | None = None


class WorkerConfig(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    auth: dict[str, Any] | None = None
    compression: dict[str, Any] | None = None
    metadata: dict[str, Any] | None = None
    permissions: dict[str, Any] | None = None
    storage: list[Any] | None = None
    user_id: str | None = None


class WorkerResetResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    message: str | None = None


class WorkerTokenResponseBody(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    expires_at: AwareDatetime | None = None
    token: str | None = None


class ResourceType(Enum):
    Document = "document"


class RoleType(Enum):
    Reader = "reader"
    Writer = "writer"
    Admin = "admin"


class SubjectType(Enum):
    User = "user"
    Group = "group"
    Any = "any"


class OperationState(Enum):
    Unknown = "unknown"
    Queued = "queued"
    Running = "running"
    Succeeded = "succeeded"
    Failed = "failed"


class CopyMetadataRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    recursive: bool | None = Field(default=None, description="Whether to copy metadata recursively")
    src_dst: list[PlainSrcDst] | None = Field(default=None, description="Sources and destinations for the copy")


class GetMetadataRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    operations: list[StoragePath] | None = Field(
        default=None, deprecated=True, description="Deprecated as of 2024.09.10"
    )
    paths: list[str] | None = Field(default=None, description="Paths to retrieve metadata for")


class MoveMetadataRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    recursive: bool | None = Field(default=None, description="Whether to move metadata recursively")
    src_dst: list[PlainSrcDst] | None = Field(default=None, description="Sources and destinations for the move")


class Operation(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    children: list[str] | None = None
    children_detail: list[Operation] | None = None
    description: str | None = None
    ended_at: AwareDatetime | None = None
    error: str | None = None
    error_detail: DetailedError | None = None
    id: str | None = None
    info: dict[str, Any] | None = None
    labels: list[str] | None = None
    max_retries: int | None = None
    messages: list[str] | None = None
    progress: float | None = None
    progress_current: conint(ge=0) | None = None
    progress_total: conint(ge=0) | None = None
    queued_at: AwareDatetime | None = None
    result: Any | None = None
    retries: int | None = None
    started_at: AwareDatetime | None = None
    state: OperationState | None = None
    user_id: str | None = None


class OperationsResponse(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    operations: list[Operation] | None = None


class PathOperations(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    operations: list[StoragePath] | None = None


class Resource(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    path: str | None = Field(default=None, examples=["my/path/to/data/file.txt"])
    type: ResourceType | None = Field(default=None, examples=["document"])


class SrcDst(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    dst: StoragePath | None = None
    src: StoragePath | None = None


class SrcDstOperations(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    operations: list[SrcDst] | None = None


class Subject(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    id: str | None = Field(default=None, examples=["946991ec-828c-4de4-acbe-962ada8bc441"])
    type: SubjectType | None = Field(default=None, examples=["user"])


class RoleAssignment(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    resource: Resource | None = None
    role: RoleType | None = None
    subject: Subject | None = None


class RoleQuery(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    resource: Resource | None = None
    role: RoleType | None = None
    subject: Subject | None = None


class SetPermissionsRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    permissions: list[RoleAssignment] | None = Field(default=None, description="Permission definitions to set")


class CheckPermissionsRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    permissions: list[RoleAssignment] | None = Field(default=None, description="Permission to check for")


class GetPermissionsRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    permissions: list[RoleQuery] | None = Field(default=None, description="Permission query to perform")


class GetPermissionsResponse(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    permissions: list[RoleAssignment] | None = Field(default=None, description="Permissions retrieved from the system")


class RemovePermissionsRequest(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    permissions: list[RoleAssignment] | None = Field(default=None, description="Permission to remove")


Operation.model_rebuild()
