# retoor <retoor@molodetz.nl>

from dataclasses import dataclass

from devplacepy.database import CONSENT_KINDS


@dataclass(frozen=True)
class Agreement:
    kind: str
    version_setting: str
    gate_column: str
    stamp_column: str


AGREEMENTS: tuple[Agreement, ...] = (
    Agreement("terms", "terms_version", "terms_version", "terms_accepted_at"),
    Agreement("privacy", "privacy_version", "", ""),
    Agreement("ai_third_party", "", "", ""),
    Agreement("activity_recording", "", "", ""),
    Agreement("container_credentials", "", "", ""),
)


def setting_key(kind: str) -> str:
    return f"acceptance_grant_{kind}"


def label_for(kind: str) -> str:
    return CONSENT_KINDS.get(kind, kind)


def agreement_for(kind: str) -> Agreement | None:
    for agreement in AGREEMENTS:
        if agreement.kind == kind:
            return agreement
    return None
