from __future__ import annotations


class Template:
    def __init__(self, data: dict):
        self.id = data.get("id")
        self.meta_template_id = data.get("meta_template_id")
        self.name = data.get("name")
        self.category = data.get("category")
        self.status = data.get("status")
        self.language = data.get("language")
        self.header_type = data.get("header_type")
        self.components = data.get("components")
        self.variable_examples = data.get("variable_examples")
        self.rejection_reason = data.get("rejection_reason")

    @property
    def is_approved(self) -> bool:
        return self.status == "approved"

    @property
    def is_rejected(self) -> bool:
        return self.status == "rejected"

    @property
    def is_pending(self) -> bool:
        return self.status == "pending"

    def to_dict(self) -> dict:
        return {
            "id": self.id,
            "name": self.name,
            "category": self.category,
            "status": self.status,
            "language": self.language,
        }
