from __future__ import annotations

import re

from app.models.mix_calculator import MixCalculatorSession
from app.schemas.mix_calculator import MixCalculatorPreviewRead


def mix_calculator_pdf_filename(session_record: MixCalculatorSession) -> str:
    raw = f"{session_record.session_number}_{session_record.client_name}_{session_record.product_name}.pdf"
    return re.sub(r"[^\w.\-]+", "_", raw)


def mix_calculator_preview_pdf_filename(preview: MixCalculatorPreviewRead) -> str:
    raw = f"MixCalculator_{preview.client_name}_{preview.product_name}_{preview.mix_date}.pdf"
    return re.sub(r"[^\w.\-]+", "_", raw)
