"""
service_rate.py — Model untuk menyimpan tarif layanan yang dapat diatur admin.
"""

from sqlalchemy import Column, Integer, String, DateTime
from datetime import datetime, timezone
from app.core.database import Base

def _utcnow():
    return datetime.now(timezone.utc)

class ServiceRate(Base):
    __tablename__ = "service_rates"

    id          = Column(Integer, primary_key=True, index=True)
    key         = Column(String, unique=True, nullable=False)  # 'transcription_rate_per_minute', 'ba_rate'
    value       = Column(Integer, nullable=False)              # dalam Rupiah
    updated_at  = Column(DateTime(timezone=True), default=_utcnow, onupdate=_utcnow)