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


class User_roles(Base):
    __tablename__ = "user_roles"
    __table_args__ = {"extend_existing": True}

    id = Column(Integer, primary_key=True, index=True, autoincrement=True, nullable=False)
    target_user_id = Column(String, nullable=False)
    role = Column(String, nullable=False)
    permissions = Column(String, nullable=True)
    created_at = Column(DateTime(timezone=True), default=datetime.now)
    updated_at = Column(DateTime(timezone=True), default=datetime.now, onupdate=datetime.now)