from sqlalchemy import Column, Integer, String, Numeric, Text, JSON, DateTime
from sqlalchemy.orm import relationship
from datetime import datetime
from ...shared.config.database import Base

class RoomType(Base):
    __tablename__ = 'room_types'
    id = Column(Integer, primary_key=True, index=True, autoincrement=True)
    name = Column(String(100), unique=True, nullable=False)
    description = Column(Text, nullable=True)
    base_price = Column(Numeric(10, 2), nullable=False)
    capacity = Column(Integer, nullable=False)
    amenities = Column(JSON, nullable=True)
    created_at = Column(DateTime, default=datetime.utcnow, nullable=False)
    updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False)
    rooms = relationship('Room', back_populates='room_type')
    rate_plans = relationship('RatePlan', back_populates='room_type')
    packages = relationship('Package', back_populates='room_type')