# coding: utf-8

"""
    Conekta API

    Conekta sdk  # noqa: E501

    The version of the OpenAPI document: 2.1.0
    Contact: engineering@conekta.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


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


from typing import Any, Dict, List, Optional
from pydantic import BaseModel, Field, StrictBool, StrictInt, StrictStr, conlist

class CheckoutResponse(BaseModel):
    """
    checkout response
    """
    allowed_payment_methods: Optional[conlist(StrictStr)] = None
    can_not_expire: Optional[StrictBool] = None
    emails_sent: Optional[StrictInt] = None
    exclude_card_networks: Optional[conlist(Dict[str, Any])] = None
    expires_at: Optional[StrictInt] = None
    failure_url: Optional[StrictStr] = None
    force_3ds_flow: Optional[StrictBool] = None
    id: StrictStr = Field(...)
    livemode: StrictBool = Field(...)
    metadata: Optional[Dict[str, Any]] = None
    monthly_installments_enabled: Optional[StrictBool] = None
    monthly_installments_options: Optional[conlist(StrictInt)] = None
    name: StrictStr = Field(..., description="Reason for charge")
    needs_shipping_contact: Optional[StrictBool] = None
    object: StrictStr = Field(...)
    paid_payments_count: Optional[StrictInt] = None
    payments_limit_count: Optional[StrictInt] = None
    recurrent: Optional[StrictBool] = None
    slug: Optional[StrictStr] = None
    sms_sent: Optional[StrictInt] = None
    starts_at: Optional[StrictInt] = None
    status: Optional[StrictStr] = None
    success_url: Optional[StrictStr] = None
    type: Optional[StrictStr] = None
    url: Optional[StrictStr] = None
    __properties = ["allowed_payment_methods", "can_not_expire", "emails_sent", "exclude_card_networks", "expires_at", "failure_url", "force_3ds_flow", "id", "livemode", "metadata", "monthly_installments_enabled", "monthly_installments_options", "name", "needs_shipping_contact", "object", "paid_payments_count", "payments_limit_count", "recurrent", "slug", "sms_sent", "starts_at", "status", "success_url", "type", "url"]

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

        return _dict

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

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

        _obj = CheckoutResponse.parse_obj({
            "allowed_payment_methods": obj.get("allowed_payment_methods"),
            "can_not_expire": obj.get("can_not_expire"),
            "emails_sent": obj.get("emails_sent"),
            "exclude_card_networks": obj.get("exclude_card_networks"),
            "expires_at": obj.get("expires_at"),
            "failure_url": obj.get("failure_url"),
            "force_3ds_flow": obj.get("force_3ds_flow"),
            "id": obj.get("id"),
            "livemode": obj.get("livemode"),
            "metadata": obj.get("metadata"),
            "monthly_installments_enabled": obj.get("monthly_installments_enabled"),
            "monthly_installments_options": obj.get("monthly_installments_options"),
            "name": obj.get("name"),
            "needs_shipping_contact": obj.get("needs_shipping_contact"),
            "object": obj.get("object"),
            "paid_payments_count": obj.get("paid_payments_count"),
            "payments_limit_count": obj.get("payments_limit_count"),
            "recurrent": obj.get("recurrent"),
            "slug": obj.get("slug"),
            "sms_sent": obj.get("sms_sent"),
            "starts_at": obj.get("starts_at"),
            "status": obj.get("status"),
            "success_url": obj.get("success_url"),
            "type": obj.get("type"),
            "url": obj.get("url")
        })
        return _obj

