from __future__ import annotations

from decimal import Decimal
from uuid import UUID

from app.infrastructure.db.models import new_id


def is_uuid(value: str) -> bool:
    try:
        UUID(str(value))
        return True
    except (ValueError, TypeError, AttributeError):
        return False


def to_decimal(value) -> Decimal:
    return Decimal(str(value or 0))


def generate_id() -> str:
    return new_id()
