# coding: utf-8

"""
    Marqeta Core API

    Simplified management of your payment programs  # noqa: E501

    The version of the OpenAPI document: 3.0.0
    Contact: dev@swadesh.co
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


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

from datetime import datetime
from typing import Optional
from pydantic import BaseModel, Field, StrictStr
from marqeta_client.models.commando_mode_enables import CommandoModeEnables
from marqeta_client.models.commando_mode_nested_transition import CommandoModeNestedTransition
from marqeta_client.models.real_time_standin_criteria import RealTimeStandinCriteria

class CommandoModeResponse(BaseModel):
    """
    CommandoModeResponse
    """
    token: Optional[StrictStr] = None
    program_gateway_funding_source_token: Optional[StrictStr] = None
    current_state: Optional[CommandoModeNestedTransition] = None
    commando_mode_enables: Optional[CommandoModeEnables] = None
    real_time_standin_criteria: Optional[RealTimeStandinCriteria] = None
    created_time: datetime = Field(..., description="yyyy-MM-ddTHH:mm:ssZ")
    last_modified_time: datetime = Field(..., description="yyyy-MM-ddTHH:mm:ssZ")
    __properties = ["token", "program_gateway_funding_source_token", "current_state", "commando_mode_enables", "real_time_standin_criteria", "created_time", "last_modified_time"]

    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) -> CommandoModeResponse:
        """Create an instance of CommandoModeResponse 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)
        # override the default output from pydantic by calling `to_dict()` of current_state
        if self.current_state:
            _dict['current_state'] = self.current_state.to_dict()
        # override the default output from pydantic by calling `to_dict()` of commando_mode_enables
        if self.commando_mode_enables:
            _dict['commando_mode_enables'] = self.commando_mode_enables.to_dict()
        # override the default output from pydantic by calling `to_dict()` of real_time_standin_criteria
        if self.real_time_standin_criteria:
            _dict['real_time_standin_criteria'] = self.real_time_standin_criteria.to_dict()
        return _dict

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

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

        _obj = CommandoModeResponse.parse_obj({
            "token": obj.get("token"),
            "program_gateway_funding_source_token": obj.get("program_gateway_funding_source_token"),
            "current_state": CommandoModeNestedTransition.from_dict(obj.get("current_state")) if obj.get("current_state") is not None else None,
            "commando_mode_enables": CommandoModeEnables.from_dict(obj.get("commando_mode_enables")) if obj.get("commando_mode_enables") is not None else None,
            "real_time_standin_criteria": RealTimeStandinCriteria.from_dict(obj.get("real_time_standin_criteria")) if obj.get("real_time_standin_criteria") is not None else None,
            "created_time": obj.get("created_time"),
            "last_modified_time": obj.get("last_modified_time")
        })
        return _obj

