# generated by datamodel-codegen:
#   filename:  hubai_openapi_fixed.json
#   timestamp: 2026-03-19T08:49:30+00:00

from __future__ import annotations

from enum import Enum, IntEnum
from typing import Annotated, Any, Literal
from uuid import UUID

from pydantic import BaseModel, ConfigDict, Field, NaiveDatetime
from typing_extensions import TypeAliasType

Name = TypeAliasType(
    "Name",
    Annotated[
        str,
        Field(
            description="Name of the Architecture.",
            max_length=255,
            title="Name",
        ),
    ],
)


Description = TypeAliasType(
    "Description",
    Annotated[
        str,
        Field(
            description="Description of the architecture.",
            max_length=255,
            title="Description",
        ),
    ],
)


class BodyDownloadApiV1ModelsDownloadGet(BaseModel):
    tags: Annotated[list[str] | None, Field(title="Tags")] = None
    snpe_version: Annotated[list[str] | None, Field(title="Snpe Version")] = (
        None
    )


class BodyUploadModelInstanceFileApiV1ModelInstancesModelInstanceIdUploadPost(
    BaseModel
):
    files: Annotated[list[bytes], Field(title="Files")]


class DataType(Enum):
    int4 = "int4"
    int8 = "int8"
    int16 = "int16"
    int32 = "int32"
    int64 = "int64"
    uint4 = "uint4"
    uint8 = "uint8"
    uint16 = "uint16"
    uint32 = "uint32"
    uint64 = "uint64"
    float16 = "float16"
    float32 = "float32"
    float64 = "float64"
    boolean = "boolean"
    string = "string"


class EnumChannelEncoding(Enum):
    RGB = "RGB"
    BGR = "BGR"
    GRAY = "GRAY"
    NONE = "NONE"


class EnumDomain(Enum):
    GENERAL = "GENERAL"


class EnumHailoVersion(Enum):
    field_2024_07 = "2024.07"
    field_2024_10 = "2024.10"


class EnumIRVersion(Enum):
    field_2021_4_0 = "2021.4.0"
    field_2022_3_0 = "2022.3.0"


class EnumJobStatusType(Enum):
    QUEUED = "QUEUED"
    RUNNING = "RUNNING"
    COMPLETED = "COMPLETED"
    FAILED = "FAILED"
    SHUTDOWN = "SHUTDOWN"


class EnumLicenseType(Enum):
    undefined = "undefined"
    MIT = "MIT"
    GNU_General_Public_License_v3_0 = "GNU General Public License v3.0"
    GNU_Affero_General_Public_License_v3_0 = (
        "GNU Affero General Public License v3.0"
    )
    Apache_2_0 = "Apache 2.0"
    NTU_S_Lab_1_0 = "NTU S-Lab 1.0"
    Ultralytics_Enterprise = "Ultralytics Enterprise"
    CreativeML_Open_RAIL_M = "CreativeML Open RAIL-M"
    BSD_3_Clause = "BSD 3-Clause"


class EnumModelClass(Enum):
    BASE = "BASE"
    EXPORTED = "EXPORTED"


class EnumModelInstanceStatus(Enum):
    available = "available"
    unavailable = "unavailable"


class EnumModelPrecisionType(Enum):
    INT8 = "INT8"
    FP16 = "FP16"
    INT8_INT16 = "INT8_INT16"
    FP32 = "FP32"


class EnumModelType(Enum):
    ONNX = "ONNX"
    IR = "IR"
    PYTORCH = "PYTORCH"
    TFLITE = "TFLITE"
    RVC2 = "RVC2"
    RVC3 = "RVC3"
    RVC4 = "RVC4"
    HAILO = "HAILO"
    RVC2_LEGACY = "RVC2_LEGACY"


class EnumPotTargetDevice(Enum):
    VPU = "VPU"
    ANY = "ANY"


class EnumQuantizationDataType(Enum):
    DRIVING = "DRIVING"
    FOOD = "FOOD"
    GENERAL = "GENERAL"
    INDOORS = "INDOORS"
    RANDOM = "RANDOM"
    WAREHOUSE = "WAREHOUSE"
    CLIP = "CLIP"
    CUSTOM = "CUSTOM"
    UNKNOWN = "UNKNOWN"


class EnumQuantizationMode(Enum):
    INT8_STANDARD = "INT8_STANDARD"
    INT8_ACCURACY_FOCUSED = "INT8_ACCURACY_FOCUSED"
    INT8_INT16_MIXED = "INT8_INT16_MIXED"
    INT8_INT16_MIXED_ACCURACY_FOCUSED = "INT8_INT16_MIXED_ACCURACY_FOCUSED"
    FP16_STANDARD = "FP16_STANDARD"
    FP32_STANDARD = "FP32_STANDARD"


class EnumSortOrder(Enum):
    asc = "asc"
    desc = "desc"


class EnumTaskType(Enum):
    CLASSIFICATION = "CLASSIFICATION"
    OBJECT_DETECTION = "OBJECT_DETECTION"
    SEGMENTATION = "SEGMENTATION"
    KEYPOINT_DETECTION = "KEYPOINT_DETECTION"
    OPTICAL_CHARACTER_RECOGNITION = "OPTICAL_CHARACTER_RECOGNITION"
    DEPTH_ESTIMATION = "DEPTH_ESTIMATION"
    LINE_DETECTION = "LINE_DETECTION"
    FEATURE_DETECTION = "FEATURE_DETECTION"
    DENOISING = "DENOISING"
    LOW_LIGHT_ENHANCEMENT = "LOW_LIGHT_ENHANCEMENT"
    SUPER_RESOLUTION = "SUPER_RESOLUTION"
    REGRESSION = "REGRESSION"
    INSTANCE_SEGMENTATION = "INSTANCE_SEGMENTATION"
    IMAGE_EMBEDDING = "IMAGE_EMBEDDING"
    SPEECH_RECOGNITION = "SPEECH_RECOGNITION"


class EnumYoloVersion(Enum):
    yolov5 = "yolov5"
    yolov6r1 = "yolov6r1"
    yolov6r3 = "yolov6r3"
    yolov6r4 = "yolov6r4"
    yolov7 = "yolov7"
    yolov8 = "yolov8"
    yolov9 = "yolov9"
    yolov10 = "yolov10"
    yolov11 = "yolov11"
    yolov12 = "yolov12"
    yolov26 = "yolov26"
    goldyolo = "goldyolo"


class GCSUploadPolicyFields(BaseModel):
    key: Annotated[str, Field(title="Key")]
    policy: Annotated[str, Field(title="Policy")]
    success_action_status: Annotated[str, Field(title="Success Action Status")]
    x_goog_algorithm: Annotated[
        str, Field(alias="x-goog-algorithm", title="X-Goog-Algorithm")
    ]
    x_goog_credential: Annotated[
        str, Field(alias="x-goog-credential", title="X-Goog-Credential")
    ]
    x_goog_date: Annotated[
        str, Field(alias="x-goog-date", title="X-Goog-Date")
    ]
    x_goog_signature: Annotated[
        str, Field(alias="x-goog-signature", title="X-Goog-Signature")
    ]


class GCSUploadPolicyResponse(BaseModel):
    url: Annotated[str, Field(title="Url")]
    fields: GCSUploadPolicyFields


class GetFromSlugsRequestItem(BaseModel):
    identifier: Annotated[
        int,
        Field(
            description="Identifier of the information.", title="Identifier"
        ),
    ]
    slug: Annotated[str, Field(description="Slug to get.", title="Slug")]


MaxQuantizationImages = TypeAliasType(
    "MaxQuantizationImages",
    Annotated[
        int,
        Field(
            description="The maximum number of images to use for quantization.",
            ge=1,
            title="Max Quantization Images",
        ),
    ],
)


class HeadClassificationMetadata(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    postprocessor_path: Annotated[
        str | None,
        Field(
            description="Path to the postprocessor.",
            title="Postprocessor Path",
        ),
    ] = None
    classes: Annotated[
        list[str],
        Field(
            description="Names of object classes recognized by the model.",
            title="Classes",
        ),
    ]
    n_classes: Annotated[
        int,
        Field(
            description="Number of object classes recognized by the model.",
            title="N Classes",
        ),
    ]
    is_softmax: Annotated[
        bool,
        Field(
            description="True, if output is already softmaxed.",
            title="Is Softmax",
        ),
    ]


class HeadMetadata(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    postprocessor_path: Annotated[
        str | None,
        Field(
            description="Path to the postprocessor.",
            title="Postprocessor Path",
        ),
    ] = None


class HeadObjectDetectionMetadata(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    postprocessor_path: Annotated[
        str | None,
        Field(
            description="Path to the postprocessor.",
            title="Postprocessor Path",
        ),
    ] = None
    classes: Annotated[
        list[str],
        Field(
            description="Names of object classes recognized by the model.",
            title="Classes",
        ),
    ]
    n_classes: Annotated[
        int,
        Field(
            description="Number of object classes recognized by the model.",
            title="N Classes",
        ),
    ]
    iou_threshold: Annotated[
        float,
        Field(
            description="Non-max supression threshold limiting boxes intersection.",
            title="Iou Threshold",
        ),
    ]
    conf_threshold: Annotated[
        float,
        Field(
            description="Confidence score threshold above which a detected object is considered valid.",
            title="Conf Threshold",
        ),
    ]
    max_det: Annotated[
        int,
        Field(description="Maximum detections per image.", title="Max Det"),
    ]
    anchors: Annotated[
        list[list[list[float]]] | None,
        Field(
            description="Predefined bounding boxes of different sizes and aspect ratios. The innermost lists are length 2 tuples of box sizes. The middle lists are anchors for each output. The outmost lists go from smallest to largest output.",
            title="Anchors",
        ),
    ] = None


class HeadObjectDetectionSSDMetadata(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    postprocessor_path: Annotated[
        str | None,
        Field(
            description="Path to the postprocessor.",
            title="Postprocessor Path",
        ),
    ] = None
    classes: Annotated[
        list[str],
        Field(
            description="Names of object classes recognized by the model.",
            title="Classes",
        ),
    ]
    n_classes: Annotated[
        int,
        Field(
            description="Number of object classes recognized by the model.",
            title="N Classes",
        ),
    ]
    iou_threshold: Annotated[
        float,
        Field(
            description="Non-max supression threshold limiting boxes intersection.",
            title="Iou Threshold",
        ),
    ]
    conf_threshold: Annotated[
        float,
        Field(
            description="Confidence score threshold above which a detected object is considered valid.",
            title="Conf Threshold",
        ),
    ]
    max_det: Annotated[
        int,
        Field(description="Maximum detections per image.", title="Max Det"),
    ]
    anchors: Annotated[
        list[list[list[float]]] | None,
        Field(
            description="Predefined bounding boxes of different sizes and aspect ratios. The innermost lists are length 2 tuples of box sizes. The middle lists are anchors for each output. The outmost lists go from smallest to largest output.",
            title="Anchors",
        ),
    ] = None
    boxes_outputs: Annotated[
        str,
        Field(
            description="Output name corresponding to predicted bounding box coordinates.",
            title="Boxes Outputs",
        ),
    ]
    scores_outputs: Annotated[
        str,
        Field(
            description="Output name corresponding to predicted bounding box confidence scores.",
            title="Scores Outputs",
        ),
    ]


class HeadSegmentationMetadata(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    postprocessor_path: Annotated[
        str | None,
        Field(
            description="Path to the postprocessor.",
            title="Postprocessor Path",
        ),
    ] = None
    classes: Annotated[
        list[str],
        Field(
            description="Names of object classes recognized by the model.",
            title="Classes",
        ),
    ]
    n_classes: Annotated[
        int,
        Field(
            description="Number of object classes recognized by the model.",
            title="N Classes",
        ),
    ]
    is_softmax: Annotated[
        bool,
        Field(
            description="True, if output is already softmaxed.",
            title="Is Softmax",
        ),
    ]


class HeadYOLOMetadata(BaseModel):
    model_config = ConfigDict(
        extra="allow",
    )
    postprocessor_path: Annotated[
        str | None,
        Field(
            description="Path to the postprocessor.",
            title="Postprocessor Path",
        ),
    ] = None
    classes: Annotated[
        list[str],
        Field(
            description="Names of object classes recognized by the model.",
            title="Classes",
        ),
    ]
    n_classes: Annotated[
        int,
        Field(
            description="Number of object classes recognized by the model.",
            title="N Classes",
        ),
    ]
    is_softmax: Annotated[
        bool | None,
        Field(
            description="True, if output is already softmaxed in YOLO instance segmentation.",
            title="Is Softmax",
        ),
    ] = None
    iou_threshold: Annotated[
        float,
        Field(
            description="Non-max supression threshold limiting boxes intersection.",
            title="Iou Threshold",
        ),
    ]
    conf_threshold: Annotated[
        float,
        Field(
            description="Confidence score threshold above which a detected object is considered valid.",
            title="Conf Threshold",
        ),
    ]
    max_det: Annotated[
        int,
        Field(description="Maximum detections per image.", title="Max Det"),
    ]
    anchors: Annotated[
        list[list[list[float]]] | None,
        Field(
            description="Predefined bounding boxes of different sizes and aspect ratios. The innermost lists are length 2 tuples of box sizes. The middle lists are anchors for each output. The outmost lists go from smallest to largest output.",
            title="Anchors",
        ),
    ] = None
    yolo_outputs: Annotated[
        list[str],
        Field(
            description="A list of output names for each of the different YOLO grid sizes.",
            title="Yolo Outputs",
        ),
    ]
    mask_outputs: Annotated[
        list[str] | None,
        Field(
            description="A list of output names for each mask output.",
            title="Mask Outputs",
        ),
    ] = None
    protos_outputs: Annotated[
        str | None,
        Field(
            description="Output name for the protos.", title="Protos Outputs"
        ),
    ] = None
    keypoints_outputs: Annotated[
        list[str] | None,
        Field(
            description="A list of output names for the keypoints.",
            title="Keypoints Outputs",
        ),
    ] = None
    angles_outputs: Annotated[
        list[str] | None,
        Field(
            description="A list of output names for the angles.",
            title="Angles Outputs",
        ),
    ] = None
    subtype: Annotated[
        str,
        Field(
            description="YOLO family decoding subtype (e.g. yolov5, yolov6, yolov7 etc.).",
            title="Subtype",
        ),
    ]
    n_prototypes: Annotated[
        int | None,
        Field(
            description="Number of prototypes per bbox in YOLO instance segmnetation.",
            title="N Prototypes",
        ),
    ] = None
    n_keypoints: Annotated[
        int | None,
        Field(
            description="Number of keypoints per bbox in YOLO keypoint detection.",
            title="N Keypoints",
        ),
    ] = None


InputName = TypeAliasType(
    "InputName",
    Annotated[
        str,
        Field(
            description="The name of the input on the file level (e.g. name of input in the ONNX). Required for multi-input but inferrable otherwise.",
            max_length=255,
            title="Input Name",
        ),
    ],
)


ShapeItem = TypeAliasType("ShapeItem", Annotated[int, Field(gt=0)])


Shape = TypeAliasType(
    "Shape",
    Annotated[
        list[ShapeItem],
        Field(
            description="The shape of the input which the NN accepts.",
            max_length=6,
            min_length=2,
            title="Shape",
        ),
    ],
)


class InputParametersOnnxIr(BaseModel):
    input_name: Annotated[
        InputName | None,
        Field(
            description="The name of the input on the file level (e.g. name of input in the ONNX). Required for multi-input but inferrable otherwise.",
            title="Input Name",
        ),
    ] = None
    scale_values: Annotated[
        list[float] | None,
        Field(
            description="A list of scale values to be used for each channel.",
            title="Scale Values",
        ),
    ] = None
    mean_values: Annotated[
        list[float] | None,
        Field(
            description="A list of mean values to be used for each channel.",
            title="Mean Values",
        ),
    ] = None
    encoding_from: Annotated[
        EnumChannelEncoding | None,
        Field(description="The encoding of the input image."),
    ] = EnumChannelEncoding.RGB
    encoding_to: Annotated[
        EnumChannelEncoding | None,
        Field(
            description="The desired encoding of converted model's input image."
        ),
    ] = EnumChannelEncoding.BGR
    reverse_input_channels: Annotated[
        bool | None,
        Field(
            description="DEPRECATED. If true, switched the input channels order from RGB to BGR.",
            title="Reverse Input Channels",
        ),
    ] = False
    layout: Annotated[
        str | None,
        Field(
            description="The layout of the input which the NN accepts.",
            title="Layout",
        ),
    ] = None
    shape: Annotated[
        Shape | None,
        Field(
            description="The shape of the input which the NN accepts.",
            title="Shape",
        ),
    ] = []


class InputType(Enum):
    raw = "raw"
    image = "image"


class JobMessageResponse(BaseModel):
    id: Annotated[str, Field(title="Id")]
    queued_at: Annotated[NaiveDatetime | None, Field(title="Queued At")] = None
    started_at: Annotated[NaiveDatetime | None, Field(title="Started At")] = (
        None
    )
    finished_at: Annotated[
        NaiveDatetime | None, Field(title="Finished At")
    ] = None
    arguments: Annotated[dict[str, Any], Field(title="Arguments")]
    extra: Annotated[dict[str, Any], Field(title="Extra")]
    logs: Annotated[str | None, Field(title="Logs")] = None
    name: Annotated[str, Field(title="Name")]
    status: EnumJobStatusType
    correlation_id: Annotated[UUID | None, Field(title="Correlation Id")] = (
        None
    )
    exception: Annotated[
        str | None,
        Field(description="Exception message if any", title="Exception"),
    ] = None
    result: Annotated[
        Any,
        Field(
            description="Result returned by the job if completed successfully.",
            title="Result",
        ),
    ] = None
    is_publishable: Annotated[
        bool | None,
        Field(
            description="Whether message should be published to Hub or not.",
            title="Is Publishable",
        ),
    ] = False


class Metadata(BaseModel):
    name: Annotated[str, Field(description="Name of the model.", title="Name")]
    path: Annotated[
        str,
        Field(
            description="Relative path to the model executable.", title="Path"
        ),
    ]
    precision: Annotated[
        DataType | None, Field(description="Precision of the model weights.")
    ] = DataType.float32


DescriptionShort = TypeAliasType(
    "DescriptionShort",
    Annotated[
        str,
        Field(
            description="Short description of the Model.",
            max_length=255,
            title="Description Short",
        ),
    ],
)


Description1 = TypeAliasType(
    "Description1",
    Annotated[
        str,
        Field(
            description="Description of the model.",
            max_length=10000,
            title="Description",
        ),
    ],
)


class ModelDownloadResponse(BaseModel):
    model_id: Annotated[
        str, Field(description="The ID of the model.", title="Model Id")
    ]
    model_version_id: Annotated[
        str,
        Field(
            description="The ID of the model version.",
            title="Model Version Id",
        ),
    ]
    model_instance_id: Annotated[
        str,
        Field(
            description="The ID of the model instance.",
            title="Model Instance Id",
        ),
    ]
    hash: Annotated[
        str,
        Field(description="The MD5 hash of the model instance.", title="Hash"),
    ]
    download_links: Annotated[
        list[str],
        Field(
            description="List of download links for the model instance.",
            title="Download Links",
        ),
    ]


class ModelInstanceDetailsRequest(BaseModel):
    model_instance_ids: Annotated[
        list[UUID],
        Field(
            description="List of IDs of the associated Model Instances.",
            title="Model Instance Ids",
        ),
    ]


class ModelInstanceFileResponse(BaseModel):
    model_instance_id: Annotated[
        str,
        Field(
            description="ID of the associated ModelInstance.",
            title="Model Instance Id",
        ),
    ]
    filepath: Annotated[
        str, Field(description="Relative path to the file.", title="Filepath")
    ]
    id: Annotated[str, Field(description="Unique identifier.", title="Id")]
    created: Annotated[
        NaiveDatetime,
        Field(description="Creation timestamp.", title="Created"),
    ]
    updated: Annotated[
        NaiveDatetime,
        Field(description="Last update timestamp.", title="Updated"),
    ]
    file_size_bytes: Annotated[
        int,
        Field(
            description="The size of the file in bytes.",
            title="File Size Bytes",
        ),
    ]


Name1 = TypeAliasType(
    "Name1",
    Annotated[
        str,
        Field(
            description="Name of the ModelInstance.",
            max_length=255,
            title="Name",
        ),
    ],
)


Description2 = TypeAliasType(
    "Description2",
    Annotated[
        str,
        Field(
            description="Changelog of the ModelInstance.",
            max_length=255,
            title="Description",
        ),
    ],
)


InputShapeItem = TypeAliasType("InputShapeItem", Annotated[int, Field(gt=0)])


class ModelInstancePatchRequest(BaseModel):
    model_version_id: Annotated[
        UUID | None,
        Field(
            description="ID of the associated Model.", title="Model Version Id"
        ),
    ] = None
    parent_id: Annotated[
        UUID | None,
        Field(
            description="Unique identifier of the parent ModelInstance.",
            title="Parent Id",
        ),
    ] = None
    model_type: Annotated[
        EnumModelType | None, Field(description="Type of the ModelInstance.")
    ] = None
    name: Annotated[
        Name1 | None,
        Field(description="Name of the ModelInstance.", title="Name"),
    ] = None
    description: Annotated[
        Description2 | None,
        Field(
            description="Changelog of the ModelInstance.", title="Description"
        ),
    ] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="List of tags associated with the Model.", title="Tags"
        ),
    ] = None
    dag_run_id: Annotated[
        UUID | None,
        Field(
            description="ID of the DagRun associated with an exported Model.",
            title="Dag Run Id",
        ),
    ] = None
    hardware_parameters: Annotated[
        dict[str, Any] | None,
        Field(
            description="Hardware parameters of the Model.",
            title="Hardware Parameters",
        ),
    ] = None
    input_shape: Annotated[
        list[list[InputShapeItem]] | None,
        Field(
            description="The input shape of the ModelInstance.",
            title="Input Shape",
        ),
    ] = None
    quantization_data: Annotated[
        EnumQuantizationDataType | UUID | None,
        Field(
            description="The data used to quantize this ModelInstance. It could be a Dataset or a pre-defined domain.",
            title="Quantization Data",
        ),
    ] = None
    yolo_version: Annotated[
        EnumYoloVersion | None,
        Field(
            description="If the model instance is PYTORCH and YOLO, the YOLO version of this instance."
        ),
    ] = None
    quantization_mode: Annotated[
        EnumQuantizationMode | None,
        Field(description="Type of the precision of the ModelInstance."),
    ] = None
    is_deployable: Annotated[
        bool | None,
        Field(
            description="Configure whether a ModelInstance is deployable or not.",
            title="Is Deployable",
        ),
    ] = None


class ModelInstancePayloadParameters(BaseModel):
    model_version_id: Annotated[
        UUID,
        Field(
            description="ID of the associated Model Version.",
            title="Model Version Id",
        ),
    ]


class ModelInstanceRequest(BaseModel):
    model_version_id: Annotated[
        UUID,
        Field(
            description="ID of the associated Model Version.",
            title="Model Version Id",
        ),
    ]
    parent_id: Annotated[
        UUID | None,
        Field(
            description="Unique identifier of the parent ModelInstance.",
            title="Parent Id",
        ),
    ] = None
    model_type: Annotated[
        EnumModelType, Field(description="Type of the ModelInstance.")
    ]
    name: Annotated[
        str,
        Field(
            description="Name of the ModelInstance.",
            max_length=255,
            title="Name",
        ),
    ]
    description: Annotated[
        Description2 | None,
        Field(
            description="Changelog of the ModelInstance.", title="Description"
        ),
    ] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="List of tags associated with the Model.", title="Tags"
        ),
    ] = None
    dag_run_id: Annotated[
        UUID | None,
        Field(
            description="ID of the DagRun associated with an exported Model.",
            title="Dag Run Id",
        ),
    ] = None
    hardware_parameters: Annotated[
        dict[str, Any] | None,
        Field(
            description="Hardware parameters of the Model.",
            title="Hardware Parameters",
        ),
    ] = None
    input_shape: Annotated[
        list[list[InputShapeItem]] | None,
        Field(
            description="The input shape of the ModelInstance.",
            title="Input Shape",
        ),
    ] = None
    quantization_data: Annotated[
        EnumQuantizationDataType | UUID | None,
        Field(
            description="The data used to quantize this ModelInstance. It could be a Dataset or a pre-defined domain.",
            title="Quantization Data",
        ),
    ] = None
    yolo_version: Annotated[
        EnumYoloVersion | None,
        Field(
            description="If the model instance is PYTORCH and YOLO, the YOLO version of this instance."
        ),
    ] = None
    quantization_mode: Annotated[
        EnumQuantizationMode | None,
        Field(description="Type of the precision of the ModelInstance."),
    ] = None
    is_deployable: Annotated[
        bool | None,
        Field(
            description="Configure whether a ModelInstance is deployable or not.",
            title="Is Deployable",
        ),
    ] = None


Hash = TypeAliasType(
    "Hash",
    Annotated[
        str,
        Field(
            description="The MD5 hash of the ModelInstance.",
            max_length=255,
            title="Hash",
        ),
    ],
)


HashShort = TypeAliasType(
    "HashShort",
    Annotated[
        str,
        Field(
            description="The first 7 characters of the MD5 hash.",
            max_length=7,
            title="Hash Short",
        ),
    ],
)


TrainingRunName = TypeAliasType(
    "TrainingRunName",
    Annotated[
        str,
        Field(
            description="Name of the training run that created this ModelInstance.",
            max_length=255,
            title="Training Run Name",
        ),
    ],
)


class ModelInstanceResponse(BaseModel):
    model_version_id: Annotated[
        str,
        Field(
            description="ID of the associated Model Version.",
            title="Model Version Id",
        ),
    ]
    parent_id: Annotated[
        str | None,
        Field(
            description="Unique identifier of the parent ModelInstance.",
            title="Parent Id",
        ),
    ] = None
    model_type: Annotated[
        EnumModelType, Field(description="Type of the ModelInstance.")
    ]
    name: Annotated[
        str,
        Field(
            description="Name of the ModelInstance.",
            max_length=255,
            title="Name",
        ),
    ]
    description: Annotated[
        Description2 | None,
        Field(
            description="Changelog of the ModelInstance.", title="Description"
        ),
    ] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="List of tags associated with the Model.", title="Tags"
        ),
    ] = None
    dag_run_id: Annotated[
        str | None,
        Field(
            description="ID of the DagRun associated with an exported Model.",
            title="Dag Run Id",
        ),
    ] = None
    hardware_parameters: Annotated[
        dict[str, Any] | None,
        Field(
            description="Hardware parameters of the Model.",
            title="Hardware Parameters",
        ),
    ] = None
    input_shape: Annotated[
        list[list[InputShapeItem]] | None,
        Field(
            description="The input shape of the ModelInstance.",
            title="Input Shape",
        ),
    ] = None
    quantization_data: Annotated[
        EnumQuantizationDataType | str | None,
        Field(
            description="The data used to quantize this ModelInstance. It could be a Dataset or a pre-defined domain.",
            title="Quantization Data",
        ),
    ] = None
    yolo_version: Annotated[
        EnumYoloVersion | None,
        Field(
            description="If the model instance is PYTORCH and YOLO, the YOLO version of this instance."
        ),
    ] = None
    id: Annotated[str, Field(description="Unique identifier.", title="Id")]
    created: Annotated[
        NaiveDatetime,
        Field(description="Creation timestamp.", title="Created"),
    ]
    updated: Annotated[
        NaiveDatetime,
        Field(description="Last update timestamp.", title="Updated"),
    ]
    slug: Annotated[
        str,
        Field(
            description="Slug for the ModelInstance.",
            max_length=255,
            title="Slug",
        ),
    ]
    is_nn_archive: Annotated[
        bool,
        Field(
            description="If NN archive is used to store files.",
            title="Is Nn Archive",
        ),
    ]
    model_class: Annotated[
        EnumModelClass | None,
        Field(
            description="DEPRECATED: Specifies whether the ModelVersion is a root, base, or exported model."
        ),
    ] = None
    model_id: Annotated[
        str | None,
        Field(description="ID of the associated Model.", title="Model Id"),
    ] = None
    exportable_to: Annotated[
        list[EnumModelType] | None,
        Field(
            description="The platforms that a ModelInstance can be exported to.",
            title="Exportable To",
        ),
    ] = []
    is_public: Annotated[
        bool | None,
        Field(
            description="Whether a ModelInstance belongs to a public model.",
            title="Is Public",
        ),
    ] = False
    model_precision_type: Annotated[
        EnumModelPrecisionType | None,
        Field(description="Type of the precision of the ModelInstance."),
    ] = None
    status: Annotated[
        EnumModelInstanceStatus | None,
        Field(
            description="Whether this model is successfully exported or uploaded and available for deployment to device."
        ),
    ] = EnumModelInstanceStatus.unavailable
    platforms: Annotated[
        list[EnumModelType] | None,
        Field(description="List of supported platforms.", title="Platforms"),
    ] = []
    hash: Annotated[
        Hash | None,
        Field(description="The MD5 hash of the ModelInstance.", title="Hash"),
    ] = None
    hash_short: Annotated[
        HashShort | None,
        Field(
            description="The first 7 characters of the MD5 hash.",
            title="Hash Short",
        ),
    ] = None
    model_version_name: Annotated[
        str | None,
        Field(
            description="Name of the associated Model Version.",
            title="Model Version Name",
        ),
    ] = None
    training_run_name: Annotated[
        TrainingRunName | None,
        Field(
            description="Name of the training run that created this ModelInstance.",
            title="Training Run Name",
        ),
    ] = None


class ModelInstanceUploadResponse(BaseModel):
    job: JobMessageResponse
    policy: GCSUploadPolicyResponse


class ModelLinkBase(BaseModel):
    name: Annotated[
        str,
        Field(
            description="Name of the link, e.g. github or huggingface.",
            title="Name",
        ),
    ]
    link: Annotated[
        str, Field(description="URL value of the link.", title="Link")
    ]


class ModelLinkResponse(BaseModel):
    name: Annotated[
        str,
        Field(
            description="Name of the link, e.g. github or huggingface.",
            title="Name",
        ),
    ]
    link: Annotated[
        str, Field(description="URL value of the link.", title="Link")
    ]


Name2 = TypeAliasType(
    "Name2",
    Annotated[
        str,
        Field(description="Name of the Model.", max_length=255, title="Name"),
    ],
)


Description5 = TypeAliasType(
    "Description5",
    Annotated[
        str,
        Field(
            description="Description of the model.",
            max_length=10000,
            title="Description",
        ),
    ],
)


class ModelPatchRequest(BaseModel):
    name: Annotated[
        Name2 | None, Field(description="Name of the Model.", title="Name")
    ] = None
    license_type: Annotated[
        EnumLicenseType | None, Field(description="Type of license.")
    ] = None
    is_public: Annotated[
        bool | None,
        Field(
            description="Flag indicating if the Model is public.",
            title="Is Public",
        ),
    ] = None
    description_short: Annotated[
        DescriptionShort | None,
        Field(
            description="Short description of the Model.",
            title="Description Short",
        ),
    ] = None
    description: Annotated[
        Description5 | None,
        Field(description="Description of the model.", title="Description"),
    ] = None
    architecture_id: Annotated[
        UUID | None,
        Field(
            description="Architecture ID specifying a trainable architecture.",
            title="Architecture Id",
        ),
    ] = None
    tasks: Annotated[
        list[EnumTaskType] | None,
        Field(description="Array of types of tasks.", title="Tasks"),
    ] = []
    links: Annotated[
        list[ModelLinkBase] | None,
        Field(
            default_factory=list,
            description="Links to official Model pages.",
            title="Links",
        ),
    ]
    is_yolo: Annotated[
        bool | None,
        Field(
            description="Whether the model is a YOLO model.", title="Is Yolo"
        ),
    ] = None
    project_id: Annotated[
        UUID | None,
        Field(description="ID of the associated Project.", title="Project Id"),
    ] = None


class ModelResponse(BaseModel):
    name: Annotated[
        str,
        Field(description="Name of the Model.", max_length=255, title="Name"),
    ]
    license_type: Annotated[
        EnumLicenseType, Field(description="Type of license.")
    ]
    is_public: Annotated[
        bool,
        Field(
            description="Flag indicating if the Model is public.",
            title="Is Public",
        ),
    ]
    description_short: Annotated[
        DescriptionShort | None,
        Field(
            description="Short description of the Model.",
            title="Description Short",
        ),
    ] = None
    description: Annotated[
        Description5 | None,
        Field(description="Description of the model.", title="Description"),
    ] = None
    architecture_id: Annotated[
        str | None,
        Field(
            description="Architecture ID specifying a trainable architecture.",
            title="Architecture Id",
        ),
    ] = None
    tasks: Annotated[
        list[EnumTaskType] | None,
        Field(description="Array of types of tasks.", title="Tasks"),
    ] = []
    links: Annotated[
        list[ModelLinkResponse] | None,
        Field(
            default_factory=list,
            description="Links to official Model pages.",
            title="Links",
        ),
    ]
    is_yolo: Annotated[
        bool | None,
        Field(
            description="Whether the model is a YOLO model.", title="Is Yolo"
        ),
    ] = False
    id: Annotated[str, Field(description="Unique identifier.", title="Id")]
    team_name: Annotated[
        str | None, Field(description="Hub team name.", title="Team Name")
    ] = None
    team_slug: Annotated[
        str | None, Field(description="Hub team slug.", title="Team Slug")
    ] = None
    created: Annotated[
        NaiveDatetime,
        Field(description="Creation timestamp.", title="Created"),
    ]
    updated: Annotated[
        NaiveDatetime,
        Field(description="Last update timestamp.", title="Updated"),
    ]
    slug: Annotated[
        str, Field(description="Slug for the Model.", title="Slug")
    ]
    likes: Annotated[
        int | None, Field(description="Number of likes.", title="Likes")
    ] = 0
    downloads: Annotated[
        int, Field(description="Number of downloads.", title="Downloads")
    ]
    versions: Annotated[
        int | None, Field(description="Number of versions.", title="Versions")
    ] = 0
    last_version_added: Annotated[
        Any,
        Field(
            description="Timestamp of the latest base model.",
            title="Last Version Added",
        ),
    ] = None
    platforms: Annotated[
        list[EnumModelType] | None,
        Field(description="List of supported platforms.", title="Platforms"),
    ] = []
    exportable_to: Annotated[
        list[EnumModelType] | None,
        Field(
            description="The platforms that a ModelVersion can be exported to.",
            title="Exportable To",
        ),
    ] = []
    project_id: Annotated[
        str | None,
        Field(
            description="Project ID associated with this model.",
            title="Project Id",
        ),
    ] = None
    is_commercial: Annotated[
        bool | None,
        Field(
            description="Is the model's license commercial.",
            title="Is Commercial",
        ),
    ] = None
    is_official: Annotated[
        bool | None,
        Field(
            description="Is the model created by Luxonis.", title="Is Official"
        ),
    ] = False
    is_liked_by_user: Annotated[
        bool | None,
        Field(
            description="True if the model is liked by the user.",
            title="Is Liked By User",
        ),
    ] = None
    model_image_link: Annotated[
        str | None,
        Field(
            description="The CDN link to upload/download model images.",
            title="Model Image Link",
        ),
    ] = None
    exportable_types: Annotated[
        list[EnumModelType] | None,
        Field(
            description="The types of models that can be exported to a target platform. Previously called base model types.",
            title="Exportable Types",
        ),
    ] = []


class ModelVersionDownloadResponse(BaseModel):
    model_instance_name: Annotated[
        str,
        Field(
            description="Name of the ModelInstance for the download link.",
            title="Model Instance Name",
        ),
    ]
    download_link: Annotated[
        str,
        Field(
            description="Presigned URL to download a file belonging to this instance.",
            title="Download Link",
        ),
    ]


Name3 = TypeAliasType(
    "Name3",
    Annotated[
        str,
        Field(
            description="Name of the ModelVersion.",
            max_length=255,
            title="Name",
        ),
    ],
)


Version = TypeAliasType(
    "Version",
    Annotated[
        str,
        Field(
            description="Semantic version of this ModelVersion (for use with model variants). It should be in the format X.Y or X.Y.Z",
            max_length=255,
            title="Version",
        ),
    ],
)


Description7 = TypeAliasType(
    "Description7",
    Annotated[
        str,
        Field(
            description="Changelog of the ModelVersion.",
            max_length=255,
            title="Description",
        ),
    ],
)


RepositoryUrl = TypeAliasType(
    "RepositoryUrl",
    Annotated[
        str,
        Field(
            description="URL of the model's repository.",
            max_length=255,
            title="Repository Url",
        ),
    ],
)


CommitHash = TypeAliasType(
    "CommitHash",
    Annotated[
        str,
        Field(
            description="Commit hash of the model in repository.",
            max_length=255,
            title="Commit Hash",
        ),
    ],
)


TrainingRunName1 = TypeAliasType(
    "TrainingRunName1",
    Annotated[
        str,
        Field(
            description="Name of the training run that created this ModelVersion.",
            max_length=255,
            title="Training Run Name",
        ),
    ],
)


class ModelVersionPatchRequest(BaseModel):
    model_id: Annotated[
        UUID | None,
        Field(description="ID of the associated Model.", title="Model Id"),
    ] = None
    name: Annotated[
        Name3 | None,
        Field(description="Name of the ModelVersion.", title="Name"),
    ] = None
    version: Annotated[
        Version | None,
        Field(
            description="Semantic version of this ModelVersion (for use with model variants). It should be in the format X.Y or X.Y.Z",
            title="Version",
        ),
    ] = None
    description: Annotated[
        Description7 | None,
        Field(
            description="Changelog of the ModelVersion.", title="Description"
        ),
    ] = None
    repository_url: Annotated[
        RepositoryUrl | None,
        Field(
            description="URL of the model's repository.",
            title="Repository Url",
        ),
    ] = None
    commit_hash: Annotated[
        CommitHash | None,
        Field(
            description="Commit hash of the model in repository.",
            title="Commit Hash",
        ),
    ] = None
    domain: Annotated[
        EnumDomain | None,
        Field(description="Domain type.", examples=["GENERAL"]),
    ] = None
    training_run_id: Annotated[
        UUID | None,
        Field(
            description="ID of the training run that created this ModelVersion.",
            title="Training Run Id",
        ),
    ] = None
    training_run_name: Annotated[
        TrainingRunName1 | None,
        Field(
            description="Name of the training run that created this ModelVersion.",
            title="Training Run Name",
        ),
    ] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="List of tags associated with the ModelVersion.",
            title="Tags",
        ),
    ] = None


class ModelVersionPayloadParameters(BaseModel):
    model_id: Annotated[
        UUID,
        Field(description="ID of the associated Model.", title="Model Id"),
    ]
    width: Annotated[
        int, Field(description="Width of the ModelVersion.", title="Width")
    ]
    height: Annotated[
        int, Field(description="Height of the ModelVersion.", title="Height")
    ]


class ModelVersionRequest(BaseModel):
    model_id: Annotated[
        UUID,
        Field(description="ID of the associated Model.", title="Model Id"),
    ]
    name: Annotated[
        str,
        Field(
            description="Name of the ModelVersion.",
            max_length=255,
            title="Name",
        ),
    ]
    version: Annotated[
        str,
        Field(
            description="Semantic version of this ModelVersion (for use with model variants). It should be in the format X.Y or X.Y.Z",
            max_length=255,
            title="Version",
        ),
    ]
    description: Annotated[
        Description7 | None,
        Field(
            description="Changelog of the ModelVersion.", title="Description"
        ),
    ] = None
    repository_url: Annotated[
        RepositoryUrl | None,
        Field(
            description="URL of the model's repository.",
            title="Repository Url",
        ),
    ] = None
    commit_hash: Annotated[
        CommitHash | None,
        Field(
            description="Commit hash of the model in repository.",
            title="Commit Hash",
        ),
    ] = None
    domain: Annotated[
        EnumDomain | None,
        Field(description="Domain type.", examples=["GENERAL"]),
    ] = None
    training_run_id: Annotated[
        UUID | None,
        Field(
            description="ID of the training run that created this ModelVersion.",
            title="Training Run Id",
        ),
    ] = None
    training_run_name: Annotated[
        TrainingRunName1 | None,
        Field(
            description="Name of the training run that created this ModelVersion.",
            title="Training Run Name",
        ),
    ] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="List of tags associated with the ModelVersion.",
            title="Tags",
        ),
    ] = None


class Output(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    name: Annotated[
        str, Field(description="Name of the output layer.", title="Name")
    ]
    dtype: Annotated[
        DataType,
        Field(description="Data type of the output data (e.g., 'float32')."),
    ]
    shape: Annotated[
        list[int] | None,
        Field(
            description="Shape of the output as a list of integers (e.g. [1, 1000]).",
            title="Shape",
        ),
    ] = None
    layout: Annotated[
        str | None,
        Field(
            description="List of letters describing the output layout (e.g. 'NC').",
            title="Layout",
        ),
    ] = None


FpsRating = TypeAliasType(
    "FpsRating",
    Annotated[
        float,
        Field(
            description="FPS rating of the architecture.",
            ge=0.0,
            title="Fps Rating",
        ),
    ],
)


class PerformanceRating(BaseModel):
    accuracy_rating: Annotated[
        int | None,
        Field(
            description="Accuracy rating of the architecture on a scale of 1-10.",
            title="Accuracy Rating",
        ),
    ]
    speed_rating: Annotated[
        int | None,
        Field(
            description="Speed rating of the architecture on a scale of 1-10.",
            title="Speed Rating",
        ),
    ]
    fps_rating: Annotated[
        FpsRating | None,
        Field(
            description="FPS rating of the architecture.", title="Fps Rating"
        ),
    ]


class PerformanceRatings(BaseModel):
    rvc2_ratings: Annotated[
        PerformanceRating,
        Field(description="Speed and accuracy rating for RVC2."),
    ]
    rvc3_ratings: Annotated[
        PerformanceRating,
        Field(description="Speed and accuracy rating for RVC3."),
    ]
    rvc4_ratings: Annotated[
        PerformanceRating,
        Field(description="Speed and accuracy rating for RVC4."),
    ]
    hailo_ratings: Annotated[
        PerformanceRating,
        Field(description="Speed and accuracy rating for Hailo."),
    ]


class PreprocessingBlock(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    mean: Annotated[
        list[float] | None,
        Field(
            description="Mean values in channel order. Order depends on the order in which the model was trained on.",
            title="Mean",
        ),
    ] = None
    scale: Annotated[
        list[float] | None,
        Field(
            description="Standardization values in channel order. Order depends on the order in which the model was trained on.",
            title="Scale",
        ),
    ] = None
    reverse_channels: Annotated[
        bool | None,
        Field(
            deprecated=True,
            description="If True input to the model is RGB else BGR.",
            title="Reverse Channels",
        ),
    ] = None
    interleaved_to_planar: Annotated[
        bool | None,
        Field(
            deprecated=True,
            description="If True input to the model is interleaved (NHWC) else planar (NCHW).",
            title="Interleaved To Planar",
        ),
    ] = None
    dai_type: Annotated[
        str | None,
        Field(
            description="DepthAI input type which is read by DepthAI to automatically setup the pipeline.",
            title="Dai Type",
        ),
    ] = None


class NumberOfShaves(IntEnum):
    integer_1 = 1
    integer_2 = 2
    integer_3 = 3
    integer_4 = 4
    integer_5 = 5
    integer_6 = 6
    integer_7 = 7
    integer_8 = 8
    integer_9 = 9
    integer_10 = 10
    integer_11 = 11
    integer_12 = 12
    integer_13 = 13
    integer_14 = 14
    integer_15 = 15
    integer_16 = 16


class RVC2ExportParametersOnnxIrPresetResponse(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    name: Annotated[
        str,
        Field(
            description="Name of the exported model.",
            max_length=255,
            title="Name",
        ),
    ]
    quantization_data: Annotated[
        EnumQuantizationDataType | str | None,
        Field(
            description="Either the domain name of the predefined quantization data (e.g. WAREHOUSE), a UUID specifying a custom dataset, or CUSTOM to upload your own quantization dataset.",
            title="Quantization Data",
        ),
    ] = None
    disable_onnx_simplification: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx simplification.",
            title="Disable Onnx Simplification",
        ),
    ] = False
    disable_onnx_optimization: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx optimization.",
            title="Disable Onnx Optimization",
        ),
    ] = False
    max_quantization_images: Annotated[
        MaxQuantizationImages | None,
        Field(
            description="The maximum number of images to use for quantization.",
            title="Max Quantization Images",
        ),
    ] = None
    inputs: Annotated[
        list[InputParametersOnnxIr] | None,
        Field(
            default_factory=list,
            description="The config defining the inputs of the model.",
            title="Inputs",
        ),
    ]
    mo_args: Annotated[
        list[str] | None,
        Field(
            description="Additional OpenVINO model optimizer args to be used for RVC2.",
            title="Mo Args",
        ),
    ] = []
    compile_tool_args: Annotated[
        list[str] | None,
        Field(
            description="Additional args to pass to compile_tool for RVC2.",
            title="Compile Tool Args",
        ),
    ] = []
    number_of_shaves: Annotated[
        NumberOfShaves | None,
        Field(
            description="Number of shaves to use for legacy RVC2.",
            title="Number Of Shaves",
        ),
    ] = None
    ir_version: Annotated[
        EnumIRVersion | None,
        Field(
            description="Modelconverter image version to be used for export."
        ),
    ] = EnumIRVersion.field_2022_3_0


class RVC3ExportParametersOnnxIr(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    name: Annotated[
        str,
        Field(
            description="Name of the exported model.",
            max_length=255,
            title="Name",
        ),
    ]
    quantization_data: Annotated[
        EnumQuantizationDataType | str | None,
        Field(
            description="Either the domain name of the predefined quantization data (e.g. WAREHOUSE), a UUID specifying a custom dataset, or CUSTOM to upload your own quantization dataset.",
            title="Quantization Data",
        ),
    ] = None
    disable_onnx_simplification: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx simplification.",
            title="Disable Onnx Simplification",
        ),
    ] = False
    disable_onnx_optimization: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx optimization.",
            title="Disable Onnx Optimization",
        ),
    ] = False
    max_quantization_images: Annotated[
        MaxQuantizationImages | None,
        Field(
            description="The maximum number of images to use for quantization.",
            title="Max Quantization Images",
        ),
    ] = None
    inputs: Annotated[
        list[InputParametersOnnxIr] | None,
        Field(
            default_factory=list,
            description="The config defining the inputs of the model.",
            title="Inputs",
        ),
    ]
    pot_target_device: Annotated[
        EnumPotTargetDevice | None,
        Field(description="Target device for POT for RVC3."),
    ] = EnumPotTargetDevice.VPU
    mo_args: Annotated[
        list[str] | None,
        Field(
            description="Additional OpenVINO model optimizer args to be used for RVC3.",
            title="Mo Args",
        ),
    ] = []
    compile_tool_args: Annotated[
        list[str] | None,
        Field(
            description="Additional args to pass to compile_tool for RVC3.",
            title="Compile Tool Args",
        ),
    ] = []
    ir_version: Annotated[
        Literal["2022.3.0"],
        Field(
            description="Modelconverter image version to be used for export.",
            title="Ir Version",
        ),
    ] = "2022.3.0"


class SnpeVersion(Enum):
    field_2_32_6 = "2.32.6"
    field_2_23_0 = "2.23.0"


class RVC4ExportParametersOnnxIr(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    name: Annotated[
        str,
        Field(
            description="Name of the exported model.",
            max_length=255,
            title="Name",
        ),
    ]
    quantization_data: Annotated[
        EnumQuantizationDataType | str | None,
        Field(
            description="Either the domain name of the predefined quantization data (e.g. WAREHOUSE), a UUID specifying a custom dataset, or CUSTOM to upload your own quantization dataset.",
            title="Quantization Data",
        ),
    ] = None
    disable_onnx_simplification: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx simplification.",
            title="Disable Onnx Simplification",
        ),
    ] = False
    disable_onnx_optimization: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx optimization.",
            title="Disable Onnx Optimization",
        ),
    ] = False
    max_quantization_images: Annotated[
        MaxQuantizationImages | None,
        Field(
            description="The maximum number of images to use for quantization.",
            title="Max Quantization Images",
        ),
    ] = None
    inputs: Annotated[
        list[InputParametersOnnxIr] | None,
        Field(
            default_factory=list,
            description="The config defining the inputs of the model.",
            title="Inputs",
        ),
    ]
    target_precision: Annotated[
        EnumQuantizationMode | None,
        Field(description="Target precision for RVC4."),
    ] = None
    snpe_onnx_to_dlc_args: Annotated[
        list[str] | None,
        Field(
            description="Additional args to pass to SNPE onnx-to-dlc for RVC4.",
            title="Snpe Onnx To Dlc Args",
        ),
    ] = []
    snpe_dlc_quant_args: Annotated[
        list[str] | None,
        Field(
            description="Additional args to pass to snpe-dlc-quant for RVC4.",
            title="Snpe Dlc Quant Args",
        ),
    ] = []
    snpe_dlc_graph_prepare_args: Annotated[
        list[str] | None,
        Field(
            description="Additional args to pass to snpe-dlc-graph-prepare for RVC4.",
            title="Snpe Dlc Graph Prepare Args",
        ),
    ] = []
    snpe_version: Annotated[
        SnpeVersion | None,
        Field(
            description="SNPE version to be used for export.",
            title="Snpe Version",
        ),
    ] = SnpeVersion.field_2_32_6


class TraceToggleRequest(BaseModel):
    enabled: Annotated[
        bool,
        Field(
            description="Whether tracing is enabled for this service.",
            title="Enabled",
        ),
    ]


class UploadQuantizationZipResponse(BaseModel):
    upload_url: Annotated[
        str,
        Field(
            description="Short-lived signed URL used to upload the custom quantization zip.",
            title="Upload Url",
        ),
    ]


class ValidationError(BaseModel):
    loc: Annotated[list[str | int], Field(title="Location")]
    msg: Annotated[str, Field(title="Message")]
    type: Annotated[str, Field(title="Error Type")]


class ArchitecturePatchRequest(BaseModel):
    name: Annotated[
        Name | None,
        Field(description="Name of the Architecture.", title="Name"),
    ] = None
    description: Annotated[
        Description | None,
        Field(
            description="Description of the architecture.", title="Description"
        ),
    ] = None
    license_type: Annotated[
        EnumLicenseType | None, Field(description="Type of license.")
    ] = None
    is_public: Annotated[
        bool | None,
        Field(
            description="Flag indicating if the Architecture is public.",
            title="Is Public",
        ),
    ] = None
    tasks: Annotated[
        list[EnumTaskType] | None,
        Field(description="Array of types of tasks.", title="Tasks"),
    ] = None
    training_image: Annotated[
        str | None,
        Field(
            description="The internal training image used in this architecture.",
            title="Training Image",
        ),
    ] = None
    training_model_config: Annotated[
        dict[str, Any] | None,
        Field(
            description="The `model` configuration block parsed by the training image.",
            title="Training Model Config",
        ),
    ] = None
    training_hyperparameter_config: Annotated[
        dict[str, Any] | None,
        Field(
            description="The `training` configuration block parsed by the training image.",
            title="Training Hyperparameter Config",
        ),
    ] = None
    performance_ratings: Annotated[
        PerformanceRatings | None,
        Field(
            description="The speed and accuracy ratings for each HW with this architecture."
        ),
    ] = None


class ArchitectureRequest(BaseModel):
    name: Annotated[
        str,
        Field(
            description="Name of the Architecture.",
            max_length=255,
            title="Name",
        ),
    ]
    description: Annotated[
        str,
        Field(
            description="Description of the architecture.",
            max_length=255,
            title="Description",
        ),
    ]
    license_type: Annotated[
        EnumLicenseType, Field(description="Type of license.")
    ]
    is_public: Annotated[
        bool,
        Field(
            description="Flag indicating if the Architecture is public.",
            title="Is Public",
        ),
    ]
    tasks: Annotated[
        list[EnumTaskType],
        Field(description="Array of types of tasks.", title="Tasks"),
    ]
    training_image: Annotated[
        str,
        Field(
            description="The internal training image used in this architecture.",
            title="Training Image",
        ),
    ]
    training_model_config: Annotated[
        dict[str, Any],
        Field(
            description="The `model` configuration block parsed by the training image.",
            title="Training Model Config",
        ),
    ]
    training_hyperparameter_config: Annotated[
        dict[str, Any],
        Field(
            description="The `training` configuration block parsed by the training image.",
            title="Training Hyperparameter Config",
        ),
    ]
    performance_ratings: Annotated[
        PerformanceRatings,
        Field(
            description="The speed and accuracy ratings for each HW with this architecture."
        ),
    ]


class ArchitectureResponse(BaseModel):
    name: Annotated[
        str,
        Field(
            description="Name of the Architecture.",
            max_length=255,
            title="Name",
        ),
    ]
    description: Annotated[
        str,
        Field(
            description="Description of the architecture.",
            max_length=255,
            title="Description",
        ),
    ]
    license_type: Annotated[
        EnumLicenseType, Field(description="Type of license.")
    ]
    is_public: Annotated[
        bool,
        Field(
            description="Flag indicating if the Architecture is public.",
            title="Is Public",
        ),
    ]
    tasks: Annotated[
        list[EnumTaskType],
        Field(description="Array of types of tasks.", title="Tasks"),
    ]
    training_image: Annotated[
        str,
        Field(
            description="The internal training image used in this architecture.",
            title="Training Image",
        ),
    ]
    training_model_config: Annotated[
        dict[str, Any],
        Field(
            description="The `model` configuration block parsed by the training image.",
            title="Training Model Config",
        ),
    ]
    training_hyperparameter_config: Annotated[
        dict[str, Any],
        Field(
            description="The `training` configuration block parsed by the training image.",
            title="Training Hyperparameter Config",
        ),
    ]
    performance_ratings: Annotated[
        PerformanceRatings,
        Field(
            description="The speed and accuracy ratings for each HW with this architecture."
        ),
    ]
    id: Annotated[str, Field(description="Unique identifier.", title="Id")]
    created: Annotated[
        NaiveDatetime,
        Field(description="Creation timestamp.", title="Created"),
    ]
    updated: Annotated[
        NaiveDatetime,
        Field(description="Last update timestamp.", title="Updated"),
    ]
    slug: Annotated[
        str,
        Field(
            description="Slug for the Architecture.",
            max_length=255,
            title="Slug",
        ),
    ]


class AvailableForModel(BaseModel):
    id: Annotated[
        str,
        Field(description="ID of the associated ModelInstance.", title="Id"),
    ]
    platform: Annotated[
        EnumModelType,
        Field(description="The target platform of the ModelInstance."),
    ]


class BodyReadAllModelInstancesApiV1ModelInstancesGet(BaseModel):
    tags: Annotated[list[str] | None, Field(title="Tags")] = None
    input_shape: Annotated[list[str] | None, Field(title="Input Shape")] = None
    platforms: Annotated[
        list[EnumModelType] | None, Field(title="Platforms")
    ] = None
    snpe_version: Annotated[list[str] | None, Field(title="Snpe Version")] = (
        None
    )
    multiple_model_version_ids: Annotated[
        list[UUID] | None, Field(title="Multiple Model Version Ids")
    ] = None


class GetFromSlugsRequest(BaseModel):
    team_slugs: Annotated[list[str] | None, Field(title="Team Slugs")] = None
    model_slugs: Annotated[list[str] | None, Field(title="Model Slugs")] = None
    variant_slugs: Annotated[
        list[str] | None, Field(title="Variant Slugs")
    ] = None
    items: Annotated[
        list[GetFromSlugsRequestItem],
        Field(description="List of slugs to get models from.", title="Items"),
    ]


class HTTPValidationError(BaseModel):
    detail: Annotated[list[ValidationError] | None, Field(title="Detail")] = (
        None
    )


class HailoExportParametersOnnxIr(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    name: Annotated[
        str,
        Field(
            description="Name of the exported model.",
            max_length=255,
            title="Name",
        ),
    ]
    quantization_data: Annotated[
        EnumQuantizationDataType | str | None,
        Field(
            description="Either the domain name of the predefined quantization data or a UUID specifying a custom dataset.",
            title="Quantization Data",
        ),
    ] = EnumQuantizationDataType.RANDOM
    disable_onnx_simplification: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx simplification.",
            title="Disable Onnx Simplification",
        ),
    ] = False
    disable_onnx_optimization: Annotated[
        bool | None,
        Field(
            description="If true, disable the onnx optimization.",
            title="Disable Onnx Optimization",
        ),
    ] = False
    max_quantization_images: Annotated[
        MaxQuantizationImages | None,
        Field(
            description="The maximum number of images to use for quantization.",
            title="Max Quantization Images",
        ),
    ] = None
    inputs: Annotated[
        list[InputParametersOnnxIr] | None,
        Field(
            default_factory=list,
            description="The config defining the inputs of the model.",
            title="Inputs",
        ),
    ]
    optimization_level: Annotated[
        int | None,
        Field(
            description="Optimization level for Hailo.",
            ge=0,
            le=4,
            title="Optimization Level",
        ),
    ] = 2
    compression_level: Annotated[
        int | None,
        Field(
            description="Compression level for Hailo.",
            ge=0,
            le=5,
            title="Compression Level",
        ),
    ] = 2
    batch_size: Annotated[
        int | None,
        Field(
            description="Batch size for Hailo.",
            ge=0,
            le=128,
            title="Batch Size",
        ),
    ] = 8
    disable_calibration: Annotated[
        bool | None,
        Field(
            description="Early stop for Hailo.", title="Disable Calibration"
        ),
    ] = False
    disable_compilation: Annotated[
        bool | None,
        Field(
            description="Disable compilation for Hailo to output a .har file instead.",
            title="Disable Compilation",
        ),
    ] = False
    alls: Annotated[
        list[str] | None,
        Field(
            description="Text representation of the Hailo alls file. Each element in the list is a line of the alls file.",
            title="Alls",
        ),
    ] = None
    hailo_version: Annotated[
        EnumHailoVersion | None,
        Field(description="Hailo version to be used for export."),
    ] = EnumHailoVersion.field_2024_10


class Head(BaseModel):
    name: Annotated[
        str | None,
        Field(description="Optional name of the head.", title="Name"),
    ] = None
    parser: Annotated[
        str,
        Field(
            description="Name of the parser responsible for processing the models output.",
            title="Parser",
        ),
    ]
    metadata: Annotated[
        HeadObjectDetectionMetadata
        | HeadClassificationMetadata
        | HeadObjectDetectionSSDMetadata
        | HeadSegmentationMetadata
        | HeadYOLOMetadata
        | HeadMetadata,
        Field(description="Metadata of the parser.", title="Metadata"),
    ]
    outputs: Annotated[
        list[str] | None,
        Field(
            description="Specify which outputs are fed into the parser. If None, all outputs are fed.",
            title="Outputs",
        ),
    ] = None


class Input(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    name: Annotated[
        str, Field(description="Name of the input layer.", title="Name")
    ]
    dtype: Annotated[
        DataType,
        Field(description="Data type of the input data (e.g., 'float32')."),
    ]
    input_type: Annotated[
        InputType, Field(description="Type of input data (e.g., 'image').")
    ]
    shape: Annotated[
        list[int],
        Field(
            description="Shape of the input data as a list of integers (e.g. [H,W], [H,W,C], [N,H,W,C], ...).",
            min_length=1,
            title="Shape",
        ),
    ]
    layout: Annotated[
        str | None,
        Field(
            description="Lettercode interpretation of the input data dimensions (e.g., 'NCHW')",
            min_length=1,
            title="Layout",
        ),
    ] = "NCHW"
    preprocessing: Annotated[
        PreprocessingBlock,
        Field(description="Preprocessing steps applied to the input data."),
    ]


class ModelInput(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    metadata: Annotated[
        Metadata,
        Field(description="Metadata object defining the model metadata."),
    ]
    inputs: Annotated[
        list[Input],
        Field(
            description="List of Input objects defining the model inputs.",
            title="Inputs",
        ),
    ]
    outputs: Annotated[
        list[Output],
        Field(
            description="List of Output objects defining the model outputs.",
            title="Outputs",
        ),
    ]
    heads: Annotated[
        list[Head] | None,
        Field(
            description="List of Head objects defining the model heads. If not defined, we assume a raw output.",
            title="Heads",
        ),
    ]


class ModelOutput(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    metadata: Annotated[
        Metadata,
        Field(description="Metadata object defining the model metadata."),
    ]
    inputs: Annotated[
        list[Input],
        Field(
            description="List of Input objects defining the model inputs.",
            title="Inputs",
        ),
    ]
    outputs: Annotated[
        list[Output],
        Field(
            description="List of Output objects defining the model outputs.",
            title="Outputs",
        ),
    ]
    heads: Annotated[
        list[Head] | None,
        Field(
            description="List of Head objects defining the model heads. If not defined, we assume a raw output.",
            title="Heads",
        ),
    ]


class ModelCreateRequest(BaseModel):
    name: Annotated[
        str,
        Field(description="Name of the Model.", max_length=255, title="Name"),
    ]
    license_type: Annotated[
        EnumLicenseType, Field(description="Type of license.")
    ]
    is_public: Annotated[
        bool,
        Field(
            description="Flag indicating if the Model is public.",
            title="Is Public",
        ),
    ]
    description_short: Annotated[
        DescriptionShort | None,
        Field(
            description="Short description of the Model.",
            title="Description Short",
        ),
    ] = None
    description: Annotated[
        Description1 | None,
        Field(description="Description of the model.", title="Description"),
    ] = None
    architecture_id: Annotated[
        UUID | None,
        Field(
            description="Architecture ID specifying a trainable architecture.",
            title="Architecture Id",
        ),
    ] = None
    tasks: Annotated[
        list[EnumTaskType] | None,
        Field(description="Array of types of tasks.", title="Tasks"),
    ] = []
    links: Annotated[
        list[ModelLinkBase] | None,
        Field(
            default_factory=list,
            description="Links to official Model pages.",
            title="Links",
        ),
    ]
    is_yolo: Annotated[
        bool | None,
        Field(
            description="Whether the model is a YOLO model.", title="Is Yolo"
        ),
    ] = False


class ModelVersionResponse(BaseModel):
    model_id: Annotated[
        str, Field(description="ID of the associated Model.", title="Model Id")
    ]
    name: Annotated[
        str,
        Field(
            description="Name of the ModelVersion.",
            max_length=255,
            title="Name",
        ),
    ]
    version: Annotated[
        str,
        Field(
            description="Semantic version of this ModelVersion (for use with model variants). It should be in the format X.Y or X.Y.Z",
            max_length=255,
            title="Version",
        ),
    ]
    description: Annotated[
        Description7 | None,
        Field(
            description="Changelog of the ModelVersion.", title="Description"
        ),
    ] = None
    repository_url: Annotated[
        RepositoryUrl | None,
        Field(
            description="URL of the model's repository.",
            title="Repository Url",
        ),
    ] = None
    commit_hash: Annotated[
        CommitHash | None,
        Field(
            description="Commit hash of the model in repository.",
            title="Commit Hash",
        ),
    ] = None
    domain: Annotated[
        EnumDomain | None,
        Field(description="Domain type.", examples=["GENERAL"]),
    ] = None
    training_run_id: Annotated[
        str | None,
        Field(
            description="ID of the training run that created this ModelVersion.",
            title="Training Run Id",
        ),
    ] = None
    training_run_name: Annotated[
        TrainingRunName1 | None,
        Field(
            description="Name of the training run that created this ModelVersion.",
            title="Training Run Name",
        ),
    ] = None
    tags: Annotated[
        list[str] | None,
        Field(
            description="List of tags associated with the ModelVersion.",
            title="Tags",
        ),
    ] = None
    id: Annotated[str, Field(description="Unique identifier.", title="Id")]
    created: Annotated[
        NaiveDatetime,
        Field(description="Creation timestamp.", title="Created"),
    ]
    updated: Annotated[
        NaiveDatetime,
        Field(description="Last update timestamp.", title="Updated"),
    ]
    slug: Annotated[
        str, Field(description="Slug for the ModelVersion.", title="Slug")
    ]
    variant_slug: Annotated[
        str,
        Field(
            description="Slug of the variant of this ModelVersion.",
            max_length=255,
            title="Variant Slug",
        ),
    ]
    platforms: Annotated[
        list[EnumModelType] | None,
        Field(description="List of supported platforms.", title="Platforms"),
    ] = []
    number_base_files: Annotated[
        int | None,
        Field(
            description="Number of base files under the ModelVersion.",
            title="Number Base Files",
        ),
    ] = 0
    is_public: Annotated[
        bool | None,
        Field(
            description="Whether a ModelVersion belongs to a public model.",
            title="Is Public",
        ),
    ] = False
    exportable_to: Annotated[
        list[EnumModelType] | None,
        Field(
            description="The platforms that a ModelVersion can be exported to.",
            title="Exportable To",
        ),
    ] = []
    available_for: Annotated[
        list[AvailableForModel] | None,
        Field(
            default_factory=list,
            description="A list of available target platforms along with the best matching model instance ID for download.",
            title="Available For",
        ),
    ]
    exportable_types: Annotated[
        list[EnumModelType] | None,
        Field(
            description="The types of models that can be exported to a target platform. Previously called base model types.",
            title="Exportable Types",
        ),
    ] = []
    has_base_nn_archive: Annotated[
        bool | None,
        Field(
            description="Whether the ModelVersion has a base model with a NN archive.",
            title="Has Base Nn Archive",
        ),
    ] = False


class ArchiveConfigurationRequest(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    config_version: Annotated[
        str | None,
        Field(
            description="String representing config schema version in format 'x.y' where x is major version and y is minor version.",
            title="Config Version",
        ),
    ] = "1.0"
    model: Annotated[
        ModelInput,
        Field(
            description="A Model object representing the neural network used in the archive."
        ),
    ]


class ArchiveConfigurationResponse(BaseModel):
    model_config = ConfigDict(
        extra="forbid",
    )
    config_version: Annotated[
        str | None,
        Field(
            description="String representing config schema version in format 'x.y' where x is major version and y is minor version.",
            title="Config Version",
        ),
    ] = "1.0"
    model: Annotated[
        ModelOutput,
        Field(
            description="A Model object representing the neural network used in the archive."
        ),
    ]


class GetFromSlugsResponseItem(BaseModel):
    identifier: Annotated[
        int,
        Field(
            description="Identifier of the information.", title="Identifier"
        ),
    ]
    model: Annotated[ModelResponse, Field(description="Model resource.")]
    model_version: Annotated[
        ModelVersionResponse,
        Field(description="Model version/variant resource."),
    ]


class ModelInstanceDetailsResponse(BaseModel):
    model_instance: Annotated[
        ModelInstanceResponse, Field(description="Model Instance details.")
    ]
    model_version: Annotated[
        ModelVersionResponse, Field(description="Model Version details.")
    ]
    model: Annotated[ModelResponse, Field(description="Model details.")]


class GetFromSlugsResponse(BaseModel):
    items: Annotated[
        list[GetFromSlugsResponseItem],
        Field(
            description="List of model and variant information corresponding to slugs.",
            title="Items",
        ),
    ]
