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

from __future__ import annotations
import dataclasses
import requests as requests_http
from ..shared import pagination as shared_pagination
from ..shared import webhooksubscription as shared_webhooksubscription
from calendly import utils
from dataclasses_json import Undefined, dataclass_json
from enum import Enum
from typing import Optional

class ListWebhooksScopeEnum(str, Enum):
    r"""Filter the list by organization or user"""
    ORGANIZATION = 'organization'
    USER = 'user'


@dataclasses.dataclass
class ListWebhooksRequest:
    
    organization: str = dataclasses.field(metadata={'query_param': { 'field_name': 'organization', 'style': 'form', 'explode': True }})
    r"""Indicates if the results should be filtered by organization"""  
    scope: ListWebhooksScopeEnum = dataclasses.field(metadata={'query_param': { 'field_name': 'scope', 'style': 'form', 'explode': True }})
    r"""Filter the list by organization or user"""  
    count: Optional[float] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'count', 'style': 'form', 'explode': True }})
    r"""The number of rows to return"""  
    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 or previous portion of the collection"""  
    sort: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'sort', 'style': 'form', 'explode': True }})
    r"""Order results by the specified field and direction. Accepts comma-separated list of {field}:{direction} values.
    Supported fields are: created_at.
    Sort direction is specified as: asc, desc.
    """  
    user: Optional[str] = dataclasses.field(default=None, metadata={'query_param': { 'field_name': 'user', 'style': 'form', 'explode': True }})
    r"""Indicates if the results should be filtered by user. This parameter is only required if the `scope` parameter is set to `user`."""  
    
class ListWebhooks403ApplicationJSONMessageEnum(str, Enum):
    YOU_DO_NOT_HAVE_PERMISSION = 'You do not have permission'
    YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THIS_RESOURCE_ = 'You do not have permission to access this resource.'
    UNAUTHORIZED = 'Unauthorized'

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


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class ListWebhooks403ApplicationJSON:
    r"""Permission Denied"""
    
    message: Optional[ListWebhooks403ApplicationJSONMessageEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('message'), 'exclude': lambda f: f is None }})  
    title: Optional[ListWebhooks403ApplicationJSONTitleEnum] = 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 ListWebhooksErrorResponseDetails:
    
    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 ListWebhooksErrorResponse:
    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[ListWebhooksErrorResponseDetails]] = 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 ListWebhooks200ApplicationJSON:
    r"""OK"""
    
    collection: list[shared_webhooksubscription.WebhookSubscription] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('collection') }})  
    pagination: shared_pagination.Pagination = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('pagination') }})  
    

@dataclasses.dataclass
class ListWebhooksResponse:
    
    content_type: str = dataclasses.field()  
    status_code: int = dataclasses.field()  
    error_response: Optional[ListWebhooksErrorResponse] = dataclasses.field(default=None)
    r"""Request is not valid"""  
    list_webhooks_200_application_json_object: Optional[ListWebhooks200ApplicationJSON] = dataclasses.field(default=None)
    r"""OK"""  
    list_webhooks_403_application_json_object: Optional[ListWebhooks403ApplicationJSON] = dataclasses.field(default=None)
    r"""Permission Denied"""  
    raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)  
    