# coding: utf-8

"""
    OurSky SDA

    The basic flow for a new organization is as follows: 1. View the available satellite targets with the [satellite targets](#tag/satellite-targets/[get]/v1/satellite-targets) endpoint. Copy the id of the target you want to observe. 2. Create an organization target with the [organization target](#tag/organization-targets/[get]/v1/organization-targets) endpoint. Use the id copied from above. 3. Create a webhook with the [webhook](#tag/webhooks/[post]/v1/communications/webhook) endpoint to receive TDMs automatically (preferred) or use the [tdms](#tag/tdms/[get]/v1/tdms) endpoint to poll for TDMs.

    The version of the OpenAPI document: 1.3.3750
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json

from datetime import datetime
from typing import Optional, Union
from pydantic import BaseModel, Field, StrictFloat, StrictInt, StrictStr
from ourskyai_sda_api.models.observation_state import ObservationState
from ourskyai_sda_api.models.tracking_type import TrackingType

class V1ObservationStatus(BaseModel):
    """
    V1ObservationStatus
    """
    id: StrictStr = Field(...)
    target_id: StrictStr = Field(..., alias="targetId")
    tracking_type: Optional[TrackingType] = Field(None, alias="trackingType")
    ra: Union[StrictFloat, StrictInt] = Field(...)
    dec: Union[StrictFloat, StrictInt] = Field(...)
    observation_time: datetime = Field(..., alias="observationTime")
    tle_line1: StrictStr = Field(..., alias="tleLine1", description="TLE line 1 of when the observation was tasked")
    tle_line2: StrictStr = Field(..., alias="tleLine2", description="TLE line 2 of when the observation was tasked")
    tle_epoch: datetime = Field(..., alias="tleEpoch")
    image_set_id: Optional[StrictStr] = Field(None, alias="imageSetId")
    observation_sequence_result_id: Optional[StrictStr] = Field(None, alias="observationSequenceResultId")
    search_instruction_id: Optional[StrictStr] = Field(None, alias="searchInstructionId")
    survey_instruction_id: Optional[StrictStr] = Field(None, alias="surveyInstructionId")
    completed_at: Optional[datetime] = Field(None, alias="completedAt")
    state: ObservationState = Field(...)
    __properties = ["id", "targetId", "trackingType", "ra", "dec", "observationTime", "tleLine1", "tleLine2", "tleEpoch", "imageSetId", "observationSequenceResultId", "searchInstructionId", "surveyInstructionId", "completedAt", "state"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.dict(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> V1ObservationStatus:
        """Create an instance of V1ObservationStatus from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> V1ObservationStatus:
        """Create an instance of V1ObservationStatus from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return V1ObservationStatus.parse_obj(obj)

        _obj = V1ObservationStatus.parse_obj({
            "id": obj.get("id"),
            "target_id": obj.get("targetId"),
            "tracking_type": obj.get("trackingType"),
            "ra": obj.get("ra"),
            "dec": obj.get("dec"),
            "observation_time": obj.get("observationTime"),
            "tle_line1": obj.get("tleLine1"),
            "tle_line2": obj.get("tleLine2"),
            "tle_epoch": obj.get("tleEpoch"),
            "image_set_id": obj.get("imageSetId"),
            "observation_sequence_result_id": obj.get("observationSequenceResultId"),
            "search_instruction_id": obj.get("searchInstructionId"),
            "survey_instruction_id": obj.get("surveyInstructionId"),
            "completed_at": obj.get("completedAt"),
            "state": obj.get("state")
        })
        return _obj


