from models import db
from peewee import *


class TelegramAccount(Model):
    id = AutoField()
    server_id = CharField(max_length=255, null=True, column_name='server_id')
    ld_name = CharField(max_length=255, null=True, column_name='ld_name')
    index_id = IntegerField(null=True, column_name='index_id')
    one_phone_number = CharField(max_length=10, null=True, column_name='one_phone_number')
    telephone = CharField(max_length=255, null=True, column_name='telephone')
    phone_type = IntegerField(null=True, column_name='phone_type')
    is_logged_in_telegram = IntegerField(null=True, column_name='is_logged_in_telegram')
    manufacturer = CharField(null=True, )  # 电话号码

    proxy_type = CharField(null=True, )  # 电话号码
    addr = CharField(null=True, )  # 电话号码
    port = CharField(null=True, )  # 电话号码
    user = CharField(null=True, )  # 电话号码
    pwd = CharField(null=True, )  # 电话号码

    # url = CharField(max_length=255, null=True, column_name='url')
    # login_cipher = CharField(max_length=255, null=True, column_name='login_cipher')
    # is_check_out_device = IntegerField(null=True, column_name='is_check_out_device')
    # check_out_device_time = CharField(max_length=255, null=True, column_name='check_out_device_time')
    # logged_in_telegram_time = CharField(max_length=255, null=True, column_name='logged_in_telegram_time')
    # is_logged_in_wallet = IntegerField(null=True, column_name='is_logged_in_wallet')
    # logged_in_wallet_time = CharField(max_length=255, null=True, column_name='logged_in_wallet_time')
    # paw_2fa = CharField(max_length=255, null=True, column_name='paw_2fa')
    # create_time = CharField(max_length=255, null=True, column_name='create_time')
    # update_time = CharField(max_length=255, null=True, column_name='update_time')
    # paw_2fa_time = CharField(max_length=255, null=True, column_name='paw_2fa_time')
    # hk_url = CharField(max_length=255, null=True, column_name='hk_url')
    # cats_stast = CharField(max_length=255, null=True, column_name='cats_stast')
    # bit_id = CharField(max_length=255, null=True, column_name='bit_id')
    # bit_name = CharField(max_length=255, null=True, column_name='bit_name')
    # backups = IntegerField(null=True, column_name='backups')
    # tg_start = CharField(max_length=255, null=True, )
    # mumu_is_logged_in_telegram = IntegerField(null=True, )

    class Meta:
        database = db
        table_name = 'teleqram_account'


class TelegramAccountMumu(Model):
    id = AutoField()
    server_id = CharField(max_length=255, null=True, column_name='server_id')
    ld_name = CharField(max_length=255, null=True, column_name='ld_name')
    index_id = IntegerField(null=True, column_name='index_id')
    one_phone_number = CharField(max_length=10, null=True, column_name='one_phone_number')
    telephone = CharField(max_length=255, null=True, column_name='telephone')
    url = CharField(max_length=255, null=True, column_name='url')
    phone_type = IntegerField(null=True, column_name='phone_type')
    is_logged_in_telegram = IntegerField(null=True, column_name='is_logged_in_telegram')
    login_cipher = CharField(max_length=255, null=True, column_name='login_cipher')
    is_check_out_device = IntegerField(null=True, column_name='is_check_out_device')
    check_out_device_time = CharField(max_length=255, null=True, column_name='check_out_device_time')
    logged_in_telegram_time = CharField(max_length=255, null=True, column_name='logged_in_telegram_time')
    is_logged_in_wallet = IntegerField(null=True, column_name='is_logged_in_wallet')
    logged_in_wallet_time = CharField(max_length=255, null=True, column_name='logged_in_wallet_time')
    paw_2fa = CharField(max_length=255, null=True, column_name='paw_2fa')
    create_time = CharField(max_length=255, null=True, column_name='create_time')
    update_time = CharField(max_length=255, null=True, column_name='update_time')
    paw_2fa_time = CharField(max_length=255, null=True, column_name='paw_2fa_time')
    hk_url = CharField(max_length=255, null=True, column_name='hk_url')
    cats_stast = CharField(max_length=255, null=True, column_name='cats_stast')
    bit_id = CharField(max_length=255, null=True, column_name='bit_id')
    bit_name = CharField(max_length=255, null=True, column_name='bit_name')
    backups = IntegerField(null=True, column_name='backups')

    class Meta:
        database = db
        table_name = 'teleqram_account_mumu'


# 定义服务器信息模型
class ServerInfo(Model):
    id = AutoField()
    server_id = CharField(max_length=255, null=True, help_text='服务器id')
    index_id = IntegerField(null=True, help_text='模拟器id')
    one_phone_number = CharField(max_length=10, null=True, help_text='电话号码区号',
                                 collation='utf8mb3_general_ci')
    telephone = CharField(max_length=255, null=True, help_text='电话号码', collation='utf8mb3_general_ci')
    url = CharField(max_length=255, null=True, help_text='验证码url', collation='utf8mb3_general_ci')
    phone_type = IntegerField(null=True, help_text='电话号码状态 0：已死1：活着')
    text = CharField(max_length=255, null=True, help_text='助忘词', collation='utf8mb3_general_ci')
    token = CharField(max_length=255, null=True, help_text='钱包地址', collation='utf8mb3_general_ci')
    is_logged_in_telegram = IntegerField(null=True, help_text='是否登录了tg 0：登录失败1：登录成功')
    login_cipher = CharField(max_length=255, null=True, help_text='登录密码', collation='utf8mb3_general_ci')
    is_check_out_device = IntegerField(null=True, help_text='是否登出设备 0 ：踢设备失败1：以踢设备')
    logged_in_telegram_time = CharField(max_length=255, null=True, help_text='登录telegram的时间',
                                        collation='utf8mb3_general_ci')
    is_logged_in_wallet = IntegerField(null=True, help_text='是否绑定了wallet 0：绑定失败1：已绑定')
    logged_in_wallet_time = CharField(max_length=255, null=True, help_text='绑定钱包时间',
                                      collation='utf8mb3_general_ci')
    is_logged_in_dogs = IntegerField(null=True, help_text='是否绑定了dogs')
    logged_in_dogs_time = CharField(max_length=255, null=True, help_text='绑定dogs时间',
                                    collation='utf8mb3_general_ci')
    is_logged_rocket = IntegerField(null=True, help_text='是否绑定小火箭 1.绑钱包 ，2.做任务 3.点击小火箭')
    logged_rocket_time = CharField(max_length=255, null=True, help_text='小火箭绑定时间',
                                   collation='utf8mb3_general_ci')
    rocket_click_integral = CharField(max_length=255, null=True, help_text='小火箭积分',
                                      collation='utf8mb4_0900_ai_ci')
    rocket_invitation_code = CharField(max_length=255, null=True, help_text='小火箭邀请码',
                                       collation='utf8mb3_general_ci')
    check_out_device_time = CharField(max_length=255, null=True, help_text='踢设备时间',
                                      collation='utf8mb3_general_ci')
    mailbox = CharField(max_length=255, null=True, help_text='设备保存邮箱', collation='utf8mb3_general_ci')
    error_text = TextField(null=True, help_text='错误信息', collation='utf8mb3_general_ci')
    evm_privateKey = CharField(max_length=255, null=True, help_text='evm私钥', collation='utf8mb3_general_ci')
    evm_address = CharField(max_length=255, null=True, help_text='evm地址', collation='utf8mb3_general_ci')
    roketocoin_code = CharField(max_length=255, null=True, help_text='太空人邀请链接',
                                collation='utf8mb3_general_ci')
    roketocoin_start_time = CharField(max_length=255, null=True, help_text='太空人开始时间',
                                      collation='utf8mb3_general_ci')
    roketocoin_stop_time = CharField(max_length=255, null=True, help_text='太空人结束时间',
                                     collation='utf8mb3_general_ci')
    upgrade_type = IntegerField(null=True, help_text='太空人升级类型')
    hk_url = CharField(max_length=255, null=True, help_text='仓鼠邀请连接')
    cats_url = CharField(max_length=255, null=True, help_text='cats邀请码')
    cats_integral = CharField(max_length=255, null=True, help_text='cats积分')
    cats_task = IntegerField(null=True, help_text='cats任务状态')
    login_email = CharField(max_length=255, null=True, help_text='登录邮箱')
    login_email_type = IntegerField(null=True, help_text='0：没有绑上，1：绑上了')
    bit_id = CharField(max_length=255, null=True, help_text='比特浏览器的id', collation='utf8mb4_0900_ai_ci')
    bit_type = CharField(max_length=255, null=True)
    blum_info = TextField(null=True, collation='utf8mb4_0900_ai_ci')
    depin_info = CharField(max_length=100, null=True)
    cs_info = TextField(null=True, collation='utf8mb4_0900_ai_ci')
    hk_wallet = IntegerField(null=True)

    class Meta:
        database = db  # 使用指定的数据库
        table_name = 'server_info'  # 表名


# 示例操作
if __name__ == "__main__":

    data = TelegramAccount.select().where(TelegramAccount.is_logged_in_telegram == 1)
    for i in data:
        print(i.id)
