#!D:\IDE\Anaconda3\envs\Microscope_Scan python
# -*- coding: UTF-8 -*-
"""
 @Author: Administrator
 @FileName: GroupModel.py
 @DateTime: 2025/6/22 20:48
 @SoftWare: PyCharm
 @Author  ：xsh
"""
from PyQt5 import Qt
from datetime import datetime, date
import copy
from AppCore.AppDBModels.CoreModel import (CoreModel, DBManager, dbController)
from sqlalchemy.orm import declarative_base, mapper, sessionmaker, Session
from sqlalchemy.orm import (declarative_base, Mapped, mapped_column, relationship, mapper, sessionmaker)
from sqlalchemy import Table, Engine, create_engine, Column, ForeignKey, and_, or_, insert, delete, update, select, func, ColumnElement,distinct
from sqlalchemy.types import (Text, VARCHAR, REAL, Float, Integer, String, SmallInteger, DateTime, Date, ARRAY,Boolean, JSON)
from sqlalchemy.orm.decl_api import DeclarativeBase, MetaData


class GroupModel(CoreModel):
    __tablename__ = 't_GroupModel'
    ID          : Mapped[int                ] = mapped_column(primary_key=True                  , nullable=False)
    IS_ACTIVE   : Mapped[int                ] = mapped_column(default=1                         , nullable=True)
    GROUPNAME   : Mapped[str                ] = mapped_column(Text, default=''                  , nullable=True)


    def __init__(self, **args):
        super(GroupModel, self).__init__()
        self.initialize()
        self.initParameter(**args)


    @classmethod
    def initModels(cls):
        items: list[GroupModel] = [
            GroupModel(ID=1, IS_ACTIVE=1, GROUPNAME='来宾'),
            GroupModel(ID=2, IS_ACTIVE=1, GROUPNAME='用户'),
            GroupModel(ID=3, IS_ACTIVE=1, GROUPNAME='管理员'),
        ]
        return items

    __field__ = (
        'ID'         ,
        'IS_ACTIVE'  ,
        'GROUPNAME'  ,
    )
    __types__ = (
        int                ,
        int                ,
        str                ,
    )