"""Pricing validators — Phase 10.4."""
from __future__ import annotations

from decimal import Decimal

from shared.exceptions import AppError

from app.validators.foundation import validate_currency_code, validate_non_empty


def validate_pricing_name(name: str) -> str:
    return validate_non_empty(name, "name")


def validate_base_amount(amount: Decimal) -> Decimal:
    if amount <= 0:
        raise AppError(
            "مبلغ پایه باید بزرگ‌تر از صفر باشد",
            status_code=422,
            error_code="invalid_base_amount",
        )
    return amount


def validate_line_amount(amount: Decimal) -> Decimal:
    return validate_base_amount(amount)


def validate_capability_name(name: str) -> str:
    return validate_non_empty(name, "name")


def validate_bundle_name(name: str) -> str:
    return validate_non_empty(name, "name")


def validate_currency(currency_code: str) -> str:
    return validate_currency_code(currency_code)
