# coding: utf-8

"""
    FlexPrice API

    FlexPrice API Service

    The version of the OpenAPI document: 1.0
    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 pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class DtoGetEventsRequest(BaseModel):
    """
    DtoGetEventsRequest
    """ # noqa: E501
    end_time: Optional[StrictStr] = Field(default=None, description="End time of the events to be fetched in ISO 8601 format Defaults to now if not provided")
    event_id: Optional[StrictStr] = Field(default=None, description="Event ID is the idempotency key for the event")
    event_name: Optional[StrictStr] = Field(default=None, description="Event name / Unique identifier for the event in your system")
    external_customer_id: Optional[StrictStr] = Field(default=None, description="Customer ID in your system that was sent with the event")
    iter_first_key: Optional[StrictStr] = Field(default=None, description="First key to iterate over the events")
    iter_last_key: Optional[StrictStr] = Field(default=None, description="Last key to iterate over the events")
    offset: Optional[StrictInt] = Field(default=None, description="Offset to fetch the events and is set to 0 by default")
    page_size: Optional[StrictInt] = Field(default=None, description="Page size to fetch the events and is set to 50 by default")
    property_filters: Optional[Dict[str, List[StrictStr]]] = Field(default=None, description="Property filters to filter the events by the keys in `properties` field of the event")
    source: Optional[StrictStr] = Field(default=None, description="Source to filter the events by the source")
    start_time: Optional[StrictStr] = Field(default=None, description="Start time of the events to be fetched in ISO 8601 format Defaults to last 7 days from now if not provided")
    __properties: ClassVar[List[str]] = ["end_time", "event_id", "event_name", "external_customer_id", "iter_first_key", "iter_last_key", "offset", "page_size", "property_filters", "source", "start_time"]

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

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

        _obj = cls.model_validate({
            "end_time": obj.get("end_time"),
            "event_id": obj.get("event_id"),
            "event_name": obj.get("event_name"),
            "external_customer_id": obj.get("external_customer_id"),
            "iter_first_key": obj.get("iter_first_key"),
            "iter_last_key": obj.get("iter_last_key"),
            "offset": obj.get("offset"),
            "page_size": obj.get("page_size"),
            "property_filters": obj.get("property_filters"),
            "source": obj.get("source"),
            "start_time": obj.get("start_time")
        })
        return _obj


