# coding: utf-8

"""
    Fiscal document service API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: v1
    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 date, datetime
from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from cloudbeds_fiscal_document.models.fiscal_document_kind import FiscalDocumentKind
from cloudbeds_fiscal_document.models.fiscal_document_status import FiscalDocumentStatus
from cloudbeds_fiscal_document.models.source_kind import SourceKind
from typing import Optional, Set
from typing_extensions import Self

class FiscalDocumentFilters(BaseModel):
    """
    FiscalDocumentFilters
    """ # noqa: E501
    ids: Optional[List[StrictStr]] = Field(default=None, description="List of IDs to filter by")
    source_ids: Optional[List[StrictStr]] = Field(default=None, description="List of source IDs to filter by", alias="sourceIds")
    source_identifiers: Optional[List[StrictStr]] = Field(default=None, description="List of source-specific identifiers", alias="sourceIdentifiers")
    source_kind: Optional[SourceKind] = Field(default=None, alias="sourceKind")
    source_kinds: Optional[List[SourceKind]] = Field(default=None, description="Filter by source kind", alias="sourceKinds")
    number_contains: Optional[StrictStr] = Field(default=None, description="Filter by document number partial match", alias="numberContains")
    statuses: Optional[List[FiscalDocumentStatus]] = Field(default=None, description="List of fiscal document statuses to filter by")
    kinds: Optional[List[FiscalDocumentKind]] = Field(default=None, description="List of fiscal document kinds to filter by")
    created_at_from: Optional[datetime] = Field(default=None, description="Creation date-time range start", alias="createdAtFrom")
    created_at_to: Optional[datetime] = Field(default=None, description="Creation date-time range end", alias="createdAtTo")
    invoice_date_from: Optional[date] = Field(default=None, description="Invoice date range start", alias="invoiceDateFrom")
    invoice_date_to: Optional[date] = Field(default=None, description="Invoice date range end", alias="invoiceDateTo")
    invoice_date_property_timezone_from: Optional[date] = Field(default=None, description="Invoice date range start", alias="invoiceDatePropertyTimezoneFrom")
    invoice_date_property_timezone_to: Optional[date] = Field(default=None, description="Invoice date range end", alias="invoiceDatePropertyTimezoneTo")
    due_date_from: Optional[date] = Field(default=None, description="Due date range start", alias="dueDateFrom")
    due_date_to: Optional[date] = Field(default=None, description="Due date range end", alias="dueDateTo")
    due_date_property_timezone_from: Optional[date] = Field(default=None, description="Due date range start", alias="dueDatePropertyTimezoneFrom")
    due_date_property_timezone_to: Optional[date] = Field(default=None, description="Due date range end", alias="dueDatePropertyTimezoneTo")
    amount_from: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum document amount", alias="amountFrom")
    amount_to: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum document amount", alias="amountTo")
    balance_from: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Minimum document balance", alias="balanceFrom")
    balance_to: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Maximum document balance", alias="balanceTo")
    __properties: ClassVar[List[str]] = ["ids", "sourceIds", "sourceIdentifiers", "sourceKind", "sourceKinds", "numberContains", "statuses", "kinds", "createdAtFrom", "createdAtTo", "invoiceDateFrom", "invoiceDateTo", "invoiceDatePropertyTimezoneFrom", "invoiceDatePropertyTimezoneTo", "dueDateFrom", "dueDateTo", "dueDatePropertyTimezoneFrom", "dueDatePropertyTimezoneTo", "amountFrom", "amountTo", "balanceFrom", "balanceTo"]

    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 FiscalDocumentFilters 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 FiscalDocumentFilters from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "ids": obj.get("ids"),
            "sourceIds": obj.get("sourceIds"),
            "sourceIdentifiers": obj.get("sourceIdentifiers"),
            "sourceKind": obj.get("sourceKind"),
            "sourceKinds": obj.get("sourceKinds"),
            "numberContains": obj.get("numberContains"),
            "statuses": obj.get("statuses"),
            "kinds": obj.get("kinds"),
            "createdAtFrom": obj.get("createdAtFrom"),
            "createdAtTo": obj.get("createdAtTo"),
            "invoiceDateFrom": obj.get("invoiceDateFrom"),
            "invoiceDateTo": obj.get("invoiceDateTo"),
            "invoiceDatePropertyTimezoneFrom": obj.get("invoiceDatePropertyTimezoneFrom"),
            "invoiceDatePropertyTimezoneTo": obj.get("invoiceDatePropertyTimezoneTo"),
            "dueDateFrom": obj.get("dueDateFrom"),
            "dueDateTo": obj.get("dueDateTo"),
            "dueDatePropertyTimezoneFrom": obj.get("dueDatePropertyTimezoneFrom"),
            "dueDatePropertyTimezoneTo": obj.get("dueDatePropertyTimezoneTo"),
            "amountFrom": obj.get("amountFrom"),
            "amountTo": obj.get("amountTo"),
            "balanceFrom": obj.get("balanceFrom"),
            "balanceTo": obj.get("balanceTo")
        })
        return _obj


