# coding: utf-8

"""
    lomi. API

    Payment processing API for francophone West African businesses.

    The version of the OpenAPI document: 1.1.0
    Contact: hello@lomi.africa
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


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

from datetime import datetime
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from uuid import UUID
from typing import Optional, Set
from typing_extensions import Self

class CheckoutSessionsUpdate(BaseModel):
    """
    Request body for updating a checkout sessions object. Only include fields you want to modify.
    """ # noqa: E501
    allow_coupon_code: Optional[StrictBool] = None
    allow_quantity: Optional[StrictBool] = None
    allowed_providers: Optional[StrictStr] = None
    amount: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Amount in the smallest currency unit (e.g., cents for USD, same for XOF)")
    cancel_url: Optional[StrictStr] = Field(default=None, description="URL/URI")
    checkout_session_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    currency_code: Optional[StrictStr] = Field(default=None, description="Three-letter ISO currency code (e.g., XOF, USD, EUR)")
    customer_email: Optional[StrictStr] = Field(default=None, description="Email address")
    customer_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    customer_name: Optional[StrictStr] = None
    customer_phone: Optional[StrictStr] = None
    expires_at: Optional[datetime] = Field(default=None, description="ISO 8601 datetime")
    installment_plan_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    is_pos: Optional[StrictBool] = None
    is_spi: Optional[StrictBool] = None
    metadata: Optional[Dict[str, Any]] = Field(default=None, description="Set of key-value pairs for storing additional information")
    payment_link_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    payment_request_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    price_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    product_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    public_description: Optional[StrictStr] = None
    qr_code_data: Optional[Dict[str, Any]] = None
    qr_code_type: Optional[StrictStr] = None
    quantity: Optional[Union[StrictFloat, StrictInt]] = None
    spi_account_number: Optional[StrictStr] = None
    spi_qr_code_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    status: Optional[StrictStr] = Field(default=None, description="Current status of the resource")
    subscription_id: Optional[UUID] = Field(default=None, description="Unique identifier (UUID format)")
    success_url: Optional[StrictStr] = Field(default=None, description="URL/URI")
    title: Optional[StrictStr] = None
    __properties: ClassVar[List[str]] = ["allow_coupon_code", "allow_quantity", "allowed_providers", "amount", "cancel_url", "checkout_session_id", "currency_code", "customer_email", "customer_id", "customer_name", "customer_phone", "expires_at", "installment_plan_id", "is_pos", "is_spi", "metadata", "payment_link_id", "payment_request_id", "price_id", "product_id", "public_description", "qr_code_data", "qr_code_type", "quantity", "spi_account_number", "spi_qr_code_id", "status", "subscription_id", "success_url", "title"]

    model_config = ConfigDict(
        populate_by_name=True,
        validate_assignment=True,
        protected_namespaces=(),
    )


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of CheckoutSessionsUpdate from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of CheckoutSessionsUpdate from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "allow_coupon_code": obj.get("allow_coupon_code"),
            "allow_quantity": obj.get("allow_quantity"),
            "allowed_providers": obj.get("allowed_providers"),
            "amount": obj.get("amount"),
            "cancel_url": obj.get("cancel_url"),
            "checkout_session_id": obj.get("checkout_session_id"),
            "currency_code": obj.get("currency_code"),
            "customer_email": obj.get("customer_email"),
            "customer_id": obj.get("customer_id"),
            "customer_name": obj.get("customer_name"),
            "customer_phone": obj.get("customer_phone"),
            "expires_at": obj.get("expires_at"),
            "installment_plan_id": obj.get("installment_plan_id"),
            "is_pos": obj.get("is_pos"),
            "is_spi": obj.get("is_spi"),
            "metadata": obj.get("metadata"),
            "payment_link_id": obj.get("payment_link_id"),
            "payment_request_id": obj.get("payment_request_id"),
            "price_id": obj.get("price_id"),
            "product_id": obj.get("product_id"),
            "public_description": obj.get("public_description"),
            "qr_code_data": obj.get("qr_code_data"),
            "qr_code_type": obj.get("qr_code_type"),
            "quantity": obj.get("quantity"),
            "spi_account_number": obj.get("spi_account_number"),
            "spi_qr_code_id": obj.get("spi_qr_code_id"),
            "status": obj.get("status"),
            "subscription_id": obj.get("subscription_id"),
            "success_url": obj.get("success_url"),
            "title": obj.get("title")
        })
        return _obj


