"""Publishing / SEO / PWA policies — Phase 11.7."""
from __future__ import annotations

from app.models.types import (
    DomainEdgeStatus,
    PublishReleaseStatus,
    PwaStatus,
    RobotsStatus,
    SeoStatus,
    SitemapStatus,
)
from app.validators.publishing import (
    ensure_edge_status_transition,
    ensure_publish_status_transition,
    ensure_simple_status_transition,
)


class PublishReleasePolicy:
    def assert_status_change(
        self, *, current: PublishReleaseStatus, target: PublishReleaseStatus
    ) -> PublishReleaseStatus:
        ensure_publish_status_transition(current, target)
        return target


class DomainEdgeBindingPolicy:
    def assert_status_change(
        self, *, current: DomainEdgeStatus, target: DomainEdgeStatus
    ) -> DomainEdgeStatus:
        ensure_edge_status_transition(current, target)
        return target


class SeoPolicy:
    def assert_status_change(
        self, *, current: SeoStatus, target: SeoStatus
    ) -> SeoStatus:
        ensure_simple_status_transition(current, target, label="seo")
        return target


class SitemapPolicy:
    def assert_status_change(
        self, *, current: SitemapStatus, target: SitemapStatus
    ) -> SitemapStatus:
        ensure_simple_status_transition(current, target, label="sitemap")
        return target


class RobotsPolicy:
    def assert_status_change(
        self, *, current: RobotsStatus, target: RobotsStatus
    ) -> RobotsStatus:
        ensure_simple_status_transition(current, target, label="robots")
        return target


class PwaPolicy:
    def assert_status_change(
        self, *, current: PwaStatus, target: PwaStatus
    ) -> PwaStatus:
        ensure_simple_status_transition(current, target, label="pwa")
        return target
