# coding: utf-8

"""
    AI Hub API

    The AI Hub REST API. See https://docs.instabase.com/api-sdk/ for more details.

    The version of the OpenAPI document: 0.1
    Contact: support@instabase.com
    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 typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictInt, StrictStr
from pydantic import Field
try:
    from typing import Self
except ImportError:
    from typing_extensions import Self

class GetAuditLogsRequest(BaseModel):
    """
    GetAuditLogsRequest
    """ # noqa: E501
    start: Optional[StrictInt] = Field(default=None, description="Number of results to skip for pagination")
    size: Optional[StrictInt] = Field(default=None, description="Maximum number of results to return")
    log_type: Optional[StrictStr] = Field(default=None, description="Type of audit log to filter by. Valid values include: - account: Account creation logs - acl: Workspace and group membership operation logs - apps: Automation app operation logs - app_deployment_run: Deployment run operation logs - app_deployment: Deployment operation logs - login: Member login and authentication logs - mount: Data connection operation logs - oauth2: OAuth token operation logs - org: Organization role change logs - org_secret: Organization secrets operation logs  For details about tracked operations, see [Viewing audit logs](/admin/audit-logs/). ")
    email: Optional[StrictStr] = Field(default=None, description="Filter logs by user email")
    start_time: Optional[StrictStr] = Field(default=None, description="Start time in epoch milliseconds")
    end_time: Optional[StrictStr] = Field(default=None, description="End time in epoch milliseconds")
    __properties: ClassVar[List[str]] = ["start", "size", "log_type", "email", "start_time", "end_time"]

    model_config = {
        "populate_by_name": True,
        "validate_assignment": True
    }


    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) -> Self:
        """Create an instance of GetAuditLogsRequest 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.
        """
        _dict = self.model_dump(
            by_alias=True,
            exclude={
            },
            exclude_none=True,
        )
        # set to None if start (nullable) is None
        # and model_fields_set contains the field
        if self.start is None and "start" in self.model_fields_set:
            _dict['start'] = None

        # set to None if size (nullable) is None
        # and model_fields_set contains the field
        if self.size is None and "size" in self.model_fields_set:
            _dict['size'] = None

        # set to None if log_type (nullable) is None
        # and model_fields_set contains the field
        if self.log_type is None and "log_type" in self.model_fields_set:
            _dict['log_type'] = None

        # set to None if email (nullable) is None
        # and model_fields_set contains the field
        if self.email is None and "email" in self.model_fields_set:
            _dict['email'] = None

        # set to None if start_time (nullable) is None
        # and model_fields_set contains the field
        if self.start_time is None and "start_time" in self.model_fields_set:
            _dict['start_time'] = None

        # set to None if end_time (nullable) is None
        # and model_fields_set contains the field
        if self.end_time is None and "end_time" in self.model_fields_set:
            _dict['end_time'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "start": obj.get("start"),
            "size": obj.get("size"),
            "log_type": obj.get("log_type"),
            "email": obj.get("email"),
            "start_time": obj.get("start_time"),
            "end_time": obj.get("end_time")
        })
        return _obj


