# This file was auto-generated by Fern from our API Definition.

import datetime as dt
import typing

import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .job_input_format import JobInputFormat
from .job_provider import JobProvider
from .job_sdk_provider import JobSdkProvider
from .job_status import JobStatus
from .json_node import JsonNode


class Job(UniversalBaseModel):
    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Unique identifier of the job within PLANQK
    """

    name: typing.Optional[str] = None
    backend_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="backendId")] = pydantic.Field(
        default=None
    )
    """
    Unique identifier of the backend
    """

    provider: typing.Optional[JobProvider] = None
    provider_job_id: typing_extensions.Annotated[typing.Optional[str], FieldMetadata(alias="providerJobId")] = (
        pydantic.Field(default=None)
    )
    """
    Unique identifier of the job assigned by the backend provider
    """

    input_params: typing_extensions.Annotated[typing.Optional[JsonNode], FieldMetadata(alias="inputParams")] = None
    input_format: typing_extensions.Annotated[typing.Optional[JobInputFormat], FieldMetadata(alias="inputFormat")] = (
        None
    )
    tags: typing.Optional[typing.List[str]] = None
    status: typing.Optional[JobStatus] = None
    created_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="createdAt")] = None
    started_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="startedAt")] = None
    ended_at: typing_extensions.Annotated[typing.Optional[dt.datetime], FieldMetadata(alias="endedAt")] = None
    shots: typing.Optional[int] = None
    sdk_provider: typing_extensions.Annotated[typing.Optional[JobSdkProvider], FieldMetadata(alias="sdkProvider")] = (
        None
    )

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
