# coding: utf-8

"""
HaploHub API

The HaploHub is a turnkey solution to securely store and interpret biomarkers, genetics, and 'omics data. Our customers use the HaploHub to:  * Store WGS, WES, low-pass, and array data with uniform REST interfaces to access variants  * Interpret genomic variants  * Generate risk scores for an individual  * Run the typical algorithms (phasing, imputation, etc.)  * Calculate 'biological age' or 'organ age' biomarkers  * Generate custom reports  The HaploHub platform is continually updated to remain at the forefront of scientific understanding.

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

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

from __future__ import annotations

import json
import pprint
import re  # noqa: F401
from datetime import date, datetime
from typing import Optional

from pydantic import BaseModel, Field, StrictInt, StrictStr


class OrderSchema(BaseModel):
    """
    OrderSchema
    """

    id: StrictStr = Field(...)
    age: Optional[StrictInt] = None
    dob: Optional[date] = None
    clia_number: Optional[StrictStr] = None
    patient: Optional[StrictStr] = None
    provider: Optional[StrictStr] = None
    laboratory: Optional[StrictStr] = None
    date_reported: Optional[datetime] = None
    date_collected: Optional[datetime] = None
    specimen_number: Optional[StrictStr] = None
    date_received: Optional[datetime] = None
    status: Optional[StrictStr] = None
    interpretation: Optional[StrictStr] = None
    __properties = [
        "id",
        "age",
        "dob",
        "clia_number",
        "patient",
        "provider",
        "laboratory",
        "date_reported",
        "date_collected",
        "specimen_number",
        "date_received",
        "status",
        "interpretation",
    ]

    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) -> OrderSchema:
        """Create an instance of OrderSchema 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)
        # set to None if age (nullable) is None
        # and __fields_set__ contains the field
        if self.age is None and "age" in self.__fields_set__:
            _dict["age"] = None

        # set to None if dob (nullable) is None
        # and __fields_set__ contains the field
        if self.dob is None and "dob" in self.__fields_set__:
            _dict["dob"] = None

        # set to None if clia_number (nullable) is None
        # and __fields_set__ contains the field
        if self.clia_number is None and "clia_number" in self.__fields_set__:
            _dict["clia_number"] = None

        # set to None if patient (nullable) is None
        # and __fields_set__ contains the field
        if self.patient is None and "patient" in self.__fields_set__:
            _dict["patient"] = None

        # set to None if provider (nullable) is None
        # and __fields_set__ contains the field
        if self.provider is None and "provider" in self.__fields_set__:
            _dict["provider"] = None

        # set to None if laboratory (nullable) is None
        # and __fields_set__ contains the field
        if self.laboratory is None and "laboratory" in self.__fields_set__:
            _dict["laboratory"] = None

        # set to None if date_reported (nullable) is None
        # and __fields_set__ contains the field
        if self.date_reported is None and "date_reported" in self.__fields_set__:
            _dict["date_reported"] = None

        # set to None if date_collected (nullable) is None
        # and __fields_set__ contains the field
        if self.date_collected is None and "date_collected" in self.__fields_set__:
            _dict["date_collected"] = None

        # set to None if specimen_number (nullable) is None
        # and __fields_set__ contains the field
        if self.specimen_number is None and "specimen_number" in self.__fields_set__:
            _dict["specimen_number"] = None

        # set to None if date_received (nullable) is None
        # and __fields_set__ contains the field
        if self.date_received is None and "date_received" in self.__fields_set__:
            _dict["date_received"] = None

        # set to None if status (nullable) is None
        # and __fields_set__ contains the field
        if self.status is None and "status" in self.__fields_set__:
            _dict["status"] = None

        # set to None if interpretation (nullable) is None
        # and __fields_set__ contains the field
        if self.interpretation is None and "interpretation" in self.__fields_set__:
            _dict["interpretation"] = None

        return _dict

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

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

        _obj = OrderSchema.parse_obj(
            {
                "id": obj.get("id"),
                "age": obj.get("age"),
                "dob": obj.get("dob"),
                "clia_number": obj.get("clia_number"),
                "patient": obj.get("patient"),
                "provider": obj.get("provider"),
                "laboratory": obj.get("laboratory"),
                "date_reported": obj.get("date_reported"),
                "date_collected": obj.get("date_collected"),
                "specimen_number": obj.get("specimen_number"),
                "date_received": obj.get("date_received"),
                "status": obj.get("status"),
                "interpretation": obj.get("interpretation"),
            }
        )
        return _obj
