# 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 typing import Dict, Optional
from pydantic import BaseModel, Field, StrictBool, StrictStr, conint, constr

class GatewayProgramFundingSourceRequest(BaseModel):
    """
    GatewayProgramFundingSourceRequest
    """
    name: constr(strict=True, max_length=50, min_length=1) = ...
    url: constr(strict=True, max_length=250, min_length=0) = ...
    token: Optional[constr(strict=True, max_length=36, min_length=1)] = None
    active: Optional[StrictBool] = None
    basic_auth_username: constr(strict=True, max_length=50, min_length=1) = ...
    basic_auth_password: constr(strict=True, max_length=100, min_length=20) = ...
    timeout_millis: Optional[conint(strict=True, le=7000, ge=1000)] = Field(None, description="Total timeout in milliseconds for gateway processing")
    custom_header: Optional[Dict[str, StrictStr]] = Field(None, description="Custom headers")
    use_mtls: Optional[StrictBool] = Field(False, description="Use MTLS for funding request")
    __properties = ["name", "url", "token", "active", "basic_auth_username", "basic_auth_password", "timeout_millis", "custom_header", "use_mtls"]

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

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

        _obj = GatewayProgramFundingSourceRequest.parse_obj({
            "name": obj.get("name"),
            "url": obj.get("url"),
            "token": obj.get("token"),
            "active": obj.get("active"),
            "basic_auth_username": obj.get("basic_auth_username"),
            "basic_auth_password": obj.get("basic_auth_password"),
            "timeout_millis": obj.get("timeout_millis"),
            "custom_header": obj.get("custom_header"),
            "use_mtls": obj.get("use_mtls") if obj.get("use_mtls") is not None else False
        })
        return _obj

