"""Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT."""

from __future__ import annotations
import dataclasses
import dateutil.parser
import requests as requests_http
from ..shared import entry as shared_entry
from ..shared import pagination as shared_pagination
from calendly import utils
from dataclasses_json import Undefined, dataclass_json
from datetime import datetime
from enum import Enum
from marshmallow import fields
from typing import Optional

class ListActivityLogSortEnum(str, Enum):
    ACTION_ASC = 'action:asc'
    ACTION_DESC = 'action:desc'
    ACTOR_DISPLAY_NAME_ASC = 'actor.display_name:asc'
    ACTOR_DISPLAY_NAME_DESC = 'actor.display_name:desc'
    ACTOR_URI_ASC = 'actor.uri:asc'
    ACTOR_URI_DESC = 'actor.uri:desc'
    NAMESPACE_ASC = 'namespace:asc'
    NAMESPACE_DESC = 'namespace:desc'
    OCCURRED_AT_ASC = 'occurred_at:asc'
    OCCURRED_AT_DESC = 'occurred_at:desc'


@dataclasses.dataclass
class ListActivityLogRequest:
    
    organization: str = dataclasses.field(metadata={'query_param': { 'field_name': 'organization', 'style': 'form', 'explode': True }})
    r"""Return activity log entries from the organization associated with this URI"""  
    action: Optional[list[str]] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'action', 'style': 'form', 'explode': False }})
    r"""The action(s) associated with the entries"""  
    actor: Optional[list[str]] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'actor', 'style': 'form', 'explode': False }})
    r"""Return entries from the user(s) associated with the provided URIs"""  
    count: Optional[int] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'count', 'style': 'form', 'explode': True }})
    r"""The number of rows to return"""  
    max_occurred_at: Optional[datetime] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'max_occurred_at', 'style': 'form', 'explode': True }})
    r"""Include entries that occurred prior to this time (sample time format: \\"2020-01-02T03:04:05.678Z\\"). This time should use the UTC timezone."""  
    min_occurred_at: Optional[datetime] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'min_occurred_at', 'style': 'form', 'explode': True }})
    r"""Include entries that occurred after this time (sample time format: \\"2020-01-02T03:04:05.678Z\\"). This time should use the UTC timezone."""  
    namespace: Optional[list[str]] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'namespace', 'style': 'form', 'explode': False }})
    r"""The categories of the entries"""  
    page_token: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'page_token', 'style': 'form', 'explode': True }})
    r"""The token to pass to get the next portion of the collection"""  
    search_term: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'search_term', 'style': 'form', 'explode': True }})
    r"""Filters entries based on the search term.
    
    Supported operators:
      - `|` - to allow filtering by one term or another. Example: `this | that`
      - `+` - to allow filtering by one term and another. Example: `this + that`
      - `\"` - to allow filtering by an exact search term. Example: `\"email@website.com\"`
      - `-` - to omit specific terms from results. Example: `Added -User`
      - `()` - to allow specifying precedence during a search. Example: `(this + that) OR (person + place)`
      - `*` - to allow prefix searching. Example `*@other-website.com`
    """  
    sort: Optional[list[ListActivityLogSortEnum]] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'sort', 'style': 'form', 'explode': False }})
    r"""Order results by the specified field and direction. List of {field}:{direction} values."""  
    
class ListActivityLog403ApplicationJSONMessageEnum(str, Enum):
    PLEASE_UPGRADE_YOUR_CALENDLY_ACCOUNT_TO_ENTERPRISE_ = 'Please upgrade your Calendly account to Enterprise.'
    YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THIS_RESOURCE_ = 'You do not have permission to access this resource.'

class ListActivityLog403ApplicationJSONTitleEnum(str, Enum):
    PERMISSION_DENIED = 'Permission Denied'


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class ListActivityLog403ApplicationJSON:
    r"""Permission Denied"""
    
    message: Optional[ListActivityLog403ApplicationJSONMessageEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('message'), 'exclude': lambda f: f is None }})  
    title: Optional[ListActivityLog403ApplicationJSONTitleEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('title'), 'exclude': lambda f: f is None }})  
    

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class ListActivityLogErrorResponseDetails:
    
    message: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('message') }})  
    parameter: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('parameter'), 'exclude': lambda f: f is None }})  
    

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class ListActivityLogErrorResponse:
    r"""Error Object"""
    
    message: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('message') }})  
    title: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('title') }})  
    details: Optional[list[ListActivityLogErrorResponseDetails]] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('details'), 'exclude': lambda f: f is None }})  
    

@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class ListActivityLog200ApplicationJSON:
    r"""Activity log response"""
    
    collection: list[shared_entry.Entry] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('collection') }})
    r"""The set of activity log entries matching the criteria"""  
    exceeds_max_total_count: bool = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('exceeds_max_total_count') }})
    r"""If there are more search results than the total_count field indicates, pagination will continue to return results past the total_count field value."""  
    pagination: shared_pagination.Pagination = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('pagination') }})  
    total_count: int = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('total_count') }})
    r"""Total number of records based on search criteria"""  
    last_event_time: Optional[datetime] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('last_event_time'), 'encoder': utils.datetimeisoformat(True), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso'), 'exclude': lambda f: f is None }})
    r"""The date and time of the newest entry (format: \\"2020-01-02T03:04:05.678Z\\") in the collection array."""  
    

@dataclasses.dataclass
class ListActivityLogResponse:
    
    content_type: str = dataclasses.field()  
    status_code: int = dataclasses.field()  
    error_response: Optional[ListActivityLogErrorResponse] = dataclasses.field(default=None)
    r"""Request is not valid"""  
    list_activity_log_200_application_json_object: Optional[ListActivityLog200ApplicationJSON] = dataclasses.field(default=None)
    r"""OK"""  
    list_activity_log_403_application_json_object: Optional[ListActivityLog403ApplicationJSON] = dataclasses.field(default=None)
    r"""Permission Denied"""  
    raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)  
    