import re
from datetime import date

from app.services.certificate_number import build_certificate_no


def test_certificate_number_shape():
    number = build_certificate_no(123, "dby", date(2026, 6, 1))
    assert re.fullmatch(r"PX2026-DBY-[23456789ABCDEFGHJKLMNPQRSTUVWXYZ]{7}-[23456789ABCDEFGHJKLMNPQRSTUVWXYZ]{2}", number)


def test_certificate_number_changes_with_sequence():
    first = build_certificate_no(123, "DBY", date(2026, 6, 1))
    second = build_certificate_no(124, "DBY", date(2026, 6, 1))
    assert first != second
