# 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 .training_assignment_response_object_response_body_status import TrainingAssignmentResponseObjectResponseBodyStatus
from .training_course_object_response_body import TrainingCourseObjectResponseBody
from .training_learner_object_response_body import TrainingLearnerObjectResponseBody


class TrainingAssignmentResponseObjectResponseBody(UniversalBaseModel):
    """
    Training Assignment response object.
    """

    completed_at_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="completedAtTime"),
        pydantic.Field(
            alias="completedAtTime",
            description='Time training assignment is completed. UTC timestamp in RFC 3339 format. Returned when a training assignment completion status is "complete".',
        ),
    ] = None
    course: TrainingCourseObjectResponseBody
    created_at_time: typing_extensions.Annotated[
        dt.datetime,
        FieldMetadata(alias="createdAtTime"),
        pydantic.Field(
            alias="createdAtTime",
            description="Creation time of the training assignment. UTC timestamp in RFC 3339 format.",
        ),
    ]
    created_by_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="createdById"),
        pydantic.Field(alias="createdById", description="ID of the user who created the training assignment."),
    ]
    deleted_at_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="deletedAtTime"),
        pydantic.Field(
            alias="deletedAtTime", description="Time training assignment is deleted. UTC timestamp in RFC 3339 format."
        ),
    ] = None
    due_at_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="dueAtTime"),
        pydantic.Field(
            alias="dueAtTime",
            description="Time training assignment is due. UTC timestamp in RFC 3339 format. Returned when an assignment has a due date set by an admin.",
        ),
    ] = None
    duration_minutes: typing_extensions.Annotated[
        int,
        FieldMetadata(alias="durationMinutes"),
        pydantic.Field(alias="durationMinutes", description="Time spent on the training assignment."),
    ]
    id: str = pydantic.Field()
    """
    ID of the training assignment.
    """

    is_completed_late: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="isCompletedLate"),
        pydantic.Field(
            alias="isCompletedLate",
            description='Indicates whether the training assignment was completed on time or not. Returned when a training assignment completion status is "complete" and has a dueAtTime set by an admin.',
        ),
    ] = None
    is_overdue: typing_extensions.Annotated[
        typing.Optional[bool],
        FieldMetadata(alias="isOverdue"),
        pydantic.Field(
            alias="isOverdue",
            description="Indicates whether the training assignment is past the due date. Returned when a training assignment completion status is 'inProgress' or 'notStarted' and has a dueAtTime set by an admin.",
        ),
    ] = None
    learner: TrainingLearnerObjectResponseBody
    score_percent: typing_extensions.Annotated[
        typing.Optional[float],
        FieldMetadata(alias="scorePercent"),
        pydantic.Field(
            alias="scorePercent",
            description='Quiz score associated with training assignment. Returned when a training assignment completion status is "complete".',
        ),
    ] = None
    started_at_time: typing_extensions.Annotated[
        typing.Optional[dt.datetime],
        FieldMetadata(alias="startedAtTime"),
        pydantic.Field(
            alias="startedAtTime",
            description='Time training assignment is started. UTC timestamp in RFC 3339 format. Returned when a training assignment completion status is "complete" or "inProgress".',
        ),
    ] = None
    status: TrainingAssignmentResponseObjectResponseBodyStatus = pydantic.Field()
    """
    State for the Training Assignment. Always returned.  Valid values: `notStarted`, `inProgress`, `completed`
    """

    updated_at_time: typing_extensions.Annotated[
        dt.datetime,
        FieldMetadata(alias="updatedAtTime"),
        pydantic.Field(
            alias="updatedAtTime",
            description="Time training assignment was updated by either a learner or an admin. UTC timestamp in RFC 3339 format.",
        ),
    ]
    updated_by_id: typing_extensions.Annotated[
        str,
        FieldMetadata(alias="updatedById"),
        pydantic.Field(
            alias="updatedById",
            description="ID of the user who updated the training assignment, either an admin or a learner.",
        ),
    ]

    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
