from __future__ import annotations

from dataclasses import dataclass
from typing import Literal


DataUsage = Literal["display", "calculation"]


@dataclass(frozen=True)
class ProviderContract:
    id: str
    provider_class: str
    calculation_allowed: bool


@dataclass(frozen=True)
class DatasetContract:
    id: str
    entity: str
    frequency: str
    primary: str
    fallbacks: tuple[str, ...]
    usage: str
    fields: tuple[str, ...]

    @property
    def providers(self) -> tuple[str, ...]:
        return (self.primary, *self.fallbacks)
