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

from __future__ import annotations
import dataclasses
import dateutil.parser
from calendly import utils
from dataclasses_json import Undefined, dataclass_json
from datetime import datetime
from enum import Enum
from marshmallow import fields

class WebhookSubscriptionEventsEnum(str, Enum):
    INVITEE_CREATED = 'invitee.created'
    INVITEE_CANCELED = 'invitee.canceled'
    ROUTING_FORM_SUBMISSION_CREATED = 'routing_form_submission.created'

class WebhookSubscriptionScopeEnum(str, Enum):
    r"""The scope of the webhook subscription"""
    USER = 'user'
    ORGANIZATION = 'organization'

class WebhookSubscriptionStateEnum(str, Enum):
    r"""Indicates if the webhook subscription is \\"active\\" or \\"disabled\\" """
    ACTIVE = 'active'
    DISABLED = 'disabled'


@dataclass_json(undefined=Undefined.EXCLUDE)
@dataclasses.dataclass
class WebhookSubscription:
    r"""Webhook Subscription Object"""
    
    callback_url: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('callback_url') }})
    r"""The callback URL to use when the event is triggered"""  
    created_at: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('created_at'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso') }})
    r"""The moment when the webhook subscription was created (e.g. \\"2020-01-02T03:04:05.678123Z\\")"""  
    creator: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('creator') }})
    r"""The URI of the user who created the webhook subscription"""  
    events: list[WebhookSubscriptionEventsEnum] = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('events') }})
    r"""A list of events to which the webhook is subscribed"""  
    organization: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('organization') }})
    r"""The URI of the organization that's associated with the webhook subscription"""  
    retry_started_at: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('retry_started_at'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso') }})
    r"""The date and time the webhook subscription is retried"""  
    scope: WebhookSubscriptionScopeEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('scope') }})
    r"""The scope of the webhook subscription"""  
    state: WebhookSubscriptionStateEnum = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('state') }})
    r"""Indicates if the webhook subscription is \\"active\\" or \\"disabled\\" """  
    updated_at: datetime = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('updated_at'), 'encoder': utils.datetimeisoformat(False), 'decoder': dateutil.parser.isoparse, 'mm_field': fields.DateTime(format='iso') }})
    r"""The moment when the webhook subscription was last updated (e.g. \\"2020-01-02T03:04:05.678123Z\\")"""  
    uri: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('uri') }})
    r"""Canonical reference (unique identifier) for the webhook"""  
    user: str = dataclasses.field(metadata={'dataclasses_json': { 'letter_case': utils.get_field_name('user') }})
    r"""The URI of the user that's associated with the webhook subscription"""  
    