from __future__ import annotations


class Webhook:
    def __init__(self, data: dict):
        self.id = data.get("id")
        self.url = data.get("url")
        self.events = data.get("events", [])
        self.active = data.get("active", True)
        self.secret = data.get("secret")
        self.created_at = data.get("created_at")
        self.updated_at = data.get("updated_at")

    @property
    def is_active(self) -> bool:
        return self.active is True

    def to_dict(self) -> dict:
        return {
            "id": self.id,
            "url": self.url,
            "events": self.events,
            "active": self.active,
        }
