from sqlalchemy import Column, Integer, String, Text, ForeignKey
from sqlalchemy.dialects.mysql import BIGINT
from mooc.db.database import Base


# ImsCoreCache模型用于映射数据库表ims_core_cache
class ImsCoreCache(Base):
    __tablename__ = "ims_core_cache"
    acid = Column(String(255), primary_key=True)  # 将主键key改为acid,并假设合适的类型,可按需调整

    class Config:
        orm_mode = True


# ImsCoreCron模型用于映射数据库表ims_core_cron
class ImsCoreCron(Base):
    __tablename__ = "ims_core_cron"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid
    createtime = Column(Integer, nullable=True)
    nextruntime = Column(Integer, nullable=True)
    uniacid = Column(Integer, nullable=True)
    cloudid = Column(Integer, nullable=True)

    class Config:
        orm_mode = True


# ImsCoreCronRecord模型用于映射数据库表ims_core_cron_record
class ImsCoreCronRecord(Base):
    __tablename__ = "ims_core_cron_record"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid
    uniacid = Column(Integer, nullable=True)
    tid = Column(Integer, nullable=True)
    module = Column(String(255), nullable=True)

    class Config:
        orm_mode = True


# ImsCoreJob模型用于映射数据库表ims_core_job
class ImsCoreJob(Base):
    __tablename__ = "ims_core_job"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid

    class Config:
        orm_mode = True


# ImsCoreMenu模型用于映射数据库表ims_core_menu
class ImsCoreMenu(Base):
    __tablename__ = "ims_core_menu"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid

    class Config:
        orm_mode = True


# ImsCoreMenuShortcut模型用于映射数据库表ims_core_menu_shortcut
class ImsCoreMenuShortcut(Base):
    __tablename__ = "ims_core_menu_shortcut"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid
    uid = Column(Integer, ForeignKey('ims_users.uid'), nullable=True)  # 假设关联ims_users表的uid字段,可按需调整

    class Config:
        orm_mode = True


# ImsCorePaylog模型用于映射数据库表ims_core_paylog
class ImsCorePaylog(Base):
    __tablename__ = "ims_core_paylog"
    acid = Column(BIGINT, primary_key=True)  # 将主键plid改为acid,假设类型为BIGINT,可按需调整
    openid = Column(String(255), nullable=True)
    tid = Column(Integer, nullable=True)
    uniacid = Column(Integer, nullable=True)
    uniontid = Column(String(255), nullable=True)

    class Config:
        orm_mode = True


# ImsCorePerformance模型用于映射数据库表ims_core_performance
class ImsCorePerformance(Base):
    __tablename__ = "ims_core_performance"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid

    class Config:
        orm_mode = True


# ImsCoreQueue模型用于映射数据库表ims_core_queue
class ImsCoreQueue(Base):
    __tablename__ = "ims_core_queue"
    acid = Column(Integer, primary_key=True)  # 将主键qid改为acid
    uniacid = Column(Integer, nullable=True)
    module = Column(String(255), nullable=True)
    dateline = Column(Integer, nullable=True)

    class Config:
        orm_mode = True


# ImsCoreRefundlog模型用于映射数据库表ims_core_refundlog
class ImsCoreRefundlog(Base):
    __tablename__ = "ims_core_refundlog"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid
    refund_uniontid = Column(String(255), nullable=True)
    uniontid = Column(String(255), nullable=True)

    class Config:
        orm_mode = True


# ImsCoreResource模型用于映射数据库表ims_core_resource
class ImsCoreResource(Base):
    __tablename__ = "ims_core_resource"
    acid = Column(Integer, primary_key=True)  # 将主键mid改为acid
    uniacid = Column(Integer, nullable=True)
    type = Column(String(255), nullable=True)

    class Config:
        orm_mode = True


# ImsCoreSendsmsLog模型用于映射数据库表ims_core_sendsms_log
class ImsCoreSendsmsLog(Base):
    __tablename__ = "ims_core_sendsms_log"
    acid = Column(Integer, primary_key=True)  # 将主键id改为acid

    class Config:
        orm_mode = True


# ImsCoreSessions模型用于映射数据库表ims_core_sessions
class ImsCoreSessions(Base):
    __tablename__ = "ims_core_sessions"
    acid = Column(String(255), primary_key=True)  # 将主键sid改为acid

    class Config:
        orm_mode = True


# ImsCoreSettings模型用于映射数据库表ims_core_settings
class ImsCoreSettings(Base):
    __tablename__ = "ims_core_settings"
    acid = Column(String(255), primary_key=True)  # 将主键key改为acid

    class Config:
        orm_mode = True