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

from __future__ import annotations
import dataclasses
import requests as requests_http
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 PostUsersUUIDWebhooksRequestBodyEventsEnum(str, Enum):
    INVITEE_CANCELED = 'invitee.canceled'
    INVITEE_CREATED = 'invitee.created'
    ROUTING_FORM_SUBMISSION_CREATED = 'routing_form_submission.created'

class PostUsersUUIDWebhooksRequestBodyScopeEnum(str, Enum):
    r"""Indicates if the webhook subscription scope will be \\"organization\\" or \\"user\\" """
    ORGANIZATION = 'organization'
    USER = 'user'


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class PostUsersUUIDWebhooksRequestBody:
    
    events: list[PostUsersUUIDWebhooksRequestBodyEventsEnum] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('events') }})
    r"""List of user events to subscribe to."""  
    organization: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('organization') }})
    r"""The unique reference to the organization that the webhook will be tied to."""  
    scope: PostUsersUUIDWebhooksRequestBodyScopeEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('scope') }})
    r"""Indicates if the webhook subscription scope will be \\"organization\\" or \\"user\\" """  
    url: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('url') }})
    r"""The URL where you want to receive POST requests for events you are subscribed to."""  
    signing_key: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('signing_key'), 'exclude': lambda f: f is None }})
    r"""Optional secret key shared between your application and Calendly. See https://developer.calendly.com/api-docs/ZG9jOjM2MzE2MDM4-webhook-signatures for additional information."""  
    user: Optional[str] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('user'), 'exclude': lambda f: f is None }})
    r"""The unique reference to the user that the webhook will be tied to."""  
    
class PostUsersUUIDWebhooks403ApplicationJSONMessageEnum(str, Enum):
    PLEASE_UPGRADE_YOUR_CALENDLY_ACCOUNT_TO_PROFESSIONAL = 'Please upgrade your Calendly account to Professional'
    YOU_DO_NOT_HAVE_PERMISSION_TO_ACCESS_THIS_RESOURCE_ = 'You do not have permission to access this resource.'
    YOU_DO_NOT_HAVE_PERMISSION = 'You do not have permission'

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


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class PostUsersUUIDWebhooks403ApplicationJSON:
    r"""Permission Denied"""
    
    message: Optional[PostUsersUUIDWebhooks403ApplicationJSONMessageEnum] = dataclasses.field(default=None, metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('message'), 'exclude': lambda f: f is None }})  
    title: Optional[PostUsersUUIDWebhooks403ApplicationJSONTitleEnum] = 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 PostUsersUUIDWebhooksErrorResponseDetails:
    
    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 PostUsersUUIDWebhooksErrorResponse:
    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[PostUsersUUIDWebhooksErrorResponseDetails]] = 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 PostUsersUUIDWebhooks201ApplicationJSON:
    r"""Created"""
    
    resource: shared_webhooksubscription.WebhookSubscription = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('resource') }})
    r"""Webhook Subscription Object"""  
    

@dataclasses.dataclass
class PostUsersUUIDWebhooksResponse:
    
    content_type: str = dataclasses.field()  
    status_code: int = dataclasses.field()  
    error_response: Optional[PostUsersUUIDWebhooksErrorResponse] = dataclasses.field(default=None)
    r"""Request is not valid"""  
    post_users_uuid_webhooks_201_application_json_object: Optional[PostUsersUUIDWebhooks201ApplicationJSON] = dataclasses.field(default=None)
    r"""Created"""  
    post_users_uuid_webhooks_403_application_json_object: Optional[PostUsersUUIDWebhooks403ApplicationJSON] = dataclasses.field(default=None)
    r"""Permission Denied"""  
    raw_response: Optional[requests_http.Response] = dataclasses.field(default=None)  
    