# 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, StrictBool, StrictInt, StrictStr, conint, constr
from marqeta_client.models.expiration_offset import ExpirationOffset
from marqeta_client.models.fulfillment_response import FulfillmentResponse
from marqeta_client.models.user_association import UserAssociation

class BulkIssuanceResponse(BaseModel):
    """
    BulkIssuanceResponse
    """
    token: constr(strict=True, max_length=36, min_length=1) = ...
    fulfillment: FulfillmentResponse = ...
    expedite: Optional[StrictBool] = False
    card_product_token: constr(strict=True, max_length=36, min_length=1) = ...
    card_allocation: conint(strict=True, le=50000) = ...
    user_association: Optional[UserAssociation] = None
    name_line_1_numeric_postfix: Optional[StrictBool] = False
    name_line_1_random_postfix: Optional[StrictBool] = False
    expiration_offset: Optional[ExpirationOffset] = None
    cards_processed: Optional[StrictInt] = None
    created_time: Optional[datetime] = None
    name_line1_start_index: Optional[StrictInt] = None
    name_line1_end_index: Optional[StrictInt] = None
    card_fulfillment_time: Optional[datetime] = None
    provider_ship_date: Optional[datetime] = None
    provider_shipping_method: Optional[StrictStr] = None
    provider_tracking_number: Optional[StrictStr] = None
    __properties = ["token", "fulfillment", "expedite", "card_product_token", "card_allocation", "user_association", "name_line_1_numeric_postfix", "name_line_1_random_postfix", "expiration_offset", "cards_processed", "created_time", "name_line1_start_index", "name_line1_end_index", "card_fulfillment_time", "provider_ship_date", "provider_shipping_method", "provider_tracking_number"]

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

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

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

        _obj = BulkIssuanceResponse.parse_obj({
            "token": obj.get("token"),
            "fulfillment": FulfillmentResponse.from_dict(obj.get("fulfillment")) if obj.get("fulfillment") is not None else None,
            "expedite": obj.get("expedite") if obj.get("expedite") is not None else False,
            "card_product_token": obj.get("card_product_token"),
            "card_allocation": obj.get("card_allocation"),
            "user_association": UserAssociation.from_dict(obj.get("user_association")) if obj.get("user_association") is not None else None,
            "name_line_1_numeric_postfix": obj.get("name_line_1_numeric_postfix") if obj.get("name_line_1_numeric_postfix") is not None else False,
            "name_line_1_random_postfix": obj.get("name_line_1_random_postfix") if obj.get("name_line_1_random_postfix") is not None else False,
            "expiration_offset": ExpirationOffset.from_dict(obj.get("expiration_offset")) if obj.get("expiration_offset") is not None else None,
            "cards_processed": obj.get("cards_processed"),
            "created_time": obj.get("created_time"),
            "name_line1_start_index": obj.get("name_line1_start_index"),
            "name_line1_end_index": obj.get("name_line1_end_index"),
            "card_fulfillment_time": obj.get("card_fulfillment_time"),
            "provider_ship_date": obj.get("provider_ship_date"),
            "provider_shipping_method": obj.get("provider_shipping_method"),
            "provider_tracking_number": obj.get("provider_tracking_number")
        })
        return _obj

