# coding: utf-8

"""
    LEIA RESTful API for AI

    Leia API  # noqa: E501

    The version of the OpenAPI document: 1.0.0
    Contact: contact@leia.io
    Generated by: https://openapi-generator.tech
"""


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

from datetime import datetime
from typing import Any, Dict, Optional
from pydantic import BaseModel, StrictBool, StrictInt, StrictStr
from leiaapi.generated.models.application_types import ApplicationTypes

class Application(BaseModel):
    """NOTE: This class is auto generated by OpenAPI Generator.
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """
    api_key: Optional[StrictStr] = None
    application_name: Optional[StrictStr] = None
    application_type: ApplicationTypes = ...
    creation_time: Optional[datetime] = None
    dedicated_workers: Optional[StrictBool] = None
    dedicated_workers_max_models: Optional[StrictInt] = None
    dedicated_workers_ttl: Optional[StrictInt] = None
    default_job_callback_url: Optional[StrictStr] = None
    email: StrictStr = ...
    first_name: StrictStr = ...
    id: Optional[StrictStr] = None
    job_counts: Optional[Dict[str, Any]] = None
    last_name: StrictStr = ...
    __properties = ["api_key", "application_name", "application_type", "creation_time", "dedicated_workers", "dedicated_workers_max_models", "dedicated_workers_ttl", "default_job_callback_url", "email", "first_name", "id", "job_counts", "last_name"]

    class Config:
        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) -> Application:
        """Create an instance of Application 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) -> Application:
        """Create an instance of Application from a dict"""
        if obj is None:
            return None

        if type(obj) is not dict:
            return Application.parse_obj(obj)

        _obj = Application.parse_obj({
            "api_key": obj.get("api_key"),
            "application_name": obj.get("application_name"),
            "application_type": obj.get("application_type"),
            "creation_time": obj.get("creation_time"),
            "dedicated_workers": obj.get("dedicated_workers"),
            "dedicated_workers_max_models": obj.get("dedicated_workers_max_models"),
            "dedicated_workers_ttl": obj.get("dedicated_workers_ttl"),
            "default_job_callback_url": obj.get("default_job_callback_url"),
            "email": obj.get("email"),
            "first_name": obj.get("first_name"),
            "id": obj.get("id"),
            "job_counts": obj.get("job_counts"),
            "last_name": obj.get("last_name")
        })
        return _obj

