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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .sync_job_status import SyncJobStatus


class SyncJob(UniversalBaseModel):
    """
    Schema for SyncJob.
    """

    sync_id: str
    status: typing.Optional[SyncJobStatus] = None
    scheduled: typing.Optional[bool] = None
    entities_inserted: typing.Optional[int] = None
    entities_updated: typing.Optional[int] = None
    entities_deleted: typing.Optional[int] = None
    entities_kept: typing.Optional[int] = None
    entities_skipped: typing.Optional[int] = None
    entities_encountered: typing.Optional[typing.Dict[str, typing.Optional[int]]] = None
    started_at: typing.Optional[dt.datetime] = None
    completed_at: typing.Optional[dt.datetime] = None
    failed_at: typing.Optional[dt.datetime] = None
    error: typing.Optional[str] = None
    access_token: typing.Optional[str] = None
    id: str
    organization_id: str
    created_by_email: typing.Optional[str] = None
    modified_by_email: typing.Optional[str] = None
    created_at: typing.Optional[dt.datetime] = None
    modified_at: typing.Optional[dt.datetime] = None
    sync_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    Name of the sync, populated from join query
    """

    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
