from __future__ import annotations

from dataclasses import dataclass


@dataclass(frozen=True)
class Postcode:
    value: str

    def __post_init__(self) -> None:
        # Frozen dataclass: bypass the descriptor with object.__setattr__.
        object.__setattr__(self, "value", "".join(self.value.split()).upper())

    def __str__(self) -> str:
        return self.value
