"""اسکیماهای اشتراک و بررسی دسترسی قابلیت."""
from __future__ import annotations

from datetime import datetime
from uuid import UUID

from pydantic import BaseModel

from app.models.enums import SubscriptionStatus
from app.schemas.common import ORMModel


class SubscriptionCreate(BaseModel):
    plan_id: UUID
    status: SubscriptionStatus = SubscriptionStatus.ACTIVE
    starts_at: datetime | None = None
    ends_at: datetime | None = None
    trial_ends_at: datetime | None = None


class SubscriptionRead(ORMModel):
    id: UUID
    tenant_id: UUID
    plan_id: UUID
    status: SubscriptionStatus
    starts_at: datetime | None
    ends_at: datetime | None
    trial_ends_at: datetime | None
    created_at: datetime


class FeatureCheckRequest(BaseModel):
    feature_key: str


class FeatureCheckResponse(BaseModel):
    tenant_id: UUID
    feature_key: str
    has_access: bool
    reason: str | None = None
