# 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, StrictStr, conint, conlist, constr

class ProductDataResponse(BaseModel):
    """
    ProductDataResponse
    """
    antifraud_info: Optional[Dict[str, Any]] = None
    brand: Optional[StrictStr] = Field(None, description="The brand of the item.")
    description: Optional[constr(strict=True, max_length=250)] = Field(None, description="Short description of the item")
    metadata: Optional[Dict[str, StrictStr]] = Field(None, description="It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.")
    name: StrictStr = Field(..., description="The name of the item. It will be displayed in the order.")
    quantity: conint(strict=True, ge=1) = Field(..., description="The quantity of the item in the order.")
    sku: Optional[StrictStr] = Field(None, description="The stock keeping unit for the item. It is used to identify the item in the order.")
    tags: Optional[conlist(StrictStr)] = Field(None, description="List of tags for the item. It is used to identify the item in the order.")
    unit_price: conint(strict=True, ge=0) = Field(..., description="The price of the item in cents.")
    id: Optional[StrictStr] = None
    object: Optional[StrictStr] = None
    parent_id: Optional[StrictStr] = None
    __properties = ["antifraud_info", "brand", "description", "metadata", "name", "quantity", "sku", "tags", "unit_price", "id", "object", "parent_id"]

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

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

        _obj = ProductDataResponse.parse_obj({
            "antifraud_info": obj.get("antifraud_info"),
            "brand": obj.get("brand"),
            "description": obj.get("description"),
            "metadata": obj.get("metadata"),
            "name": obj.get("name"),
            "quantity": obj.get("quantity"),
            "sku": obj.get("sku"),
            "tags": obj.get("tags"),
            "unit_price": obj.get("unit_price"),
            "id": obj.get("id"),
            "object": obj.get("object"),
            "parent_id": obj.get("parent_id")
        })
        return _obj

