# Python's forms of matching, unpacking and printing that Vibe takes (D188): capture
# patterns with guards, class patterns on a plain dataclass with literal values in them,
# tuple unpacking that declares, and print's sep=. Its output is CPython's.
from dataclasses import dataclass


@dataclass
class Point:
    x: int
    y: int


def kind(n: int) -> str:
    match n:
        case 0:
            return "zero"
        case k if k < 0:
            return "negative"
        case _:
            return "positive"


def where(p: Point) -> str:
    match p:
        case Point(x=0, y=0):
            return "origin"
        case Point(x=0):
            return "on the y axis"
        case Point(x=a, y=b) if a == b:
            return "diagonal"
        case _:
            return "elsewhere"


def described(n: int) -> str:
    match n:
        case 1 | 2:
            return "small"
        case big:
            return f"{big} is big"


def main() -> None:
    print(kind(0), kind(-4), kind(9), sep=", ")
    print(where(Point(0, 0)), where(Point(0, 5)), where(Point(2, 2)), where(Point(1, 2)), sep=" | ")
    print(described(2), described(40))
    a, b = 1, 2
    a, b = b, a
    q, r = divmod(17, 5)
    print(a, b, q, r, sep="-")
    t = (3, "three", 3.5)
    n, word, f = t
    print(t, n, word, f, t[-1])
    print("no", "space", sep="")
    print(1, 2, 3, sep=", ", end=".\n")


if __name__ == "__main__":
    main()
