package models

import (
	"go-admin/common/models"
)

type LineApiUser struct {
	models.Model

	ExchangeType string `json:"exchangeType" gorm:"type:varchar(20);comment:交易所类型(字典 exchange_type)"`
	UserId       int64  `json:"userId" gorm:"type:int unsigned;comment:用户id"`
	// JysId        int64  `json:"jysId" gorm:"type:int;comment:关联交易所账号id"`
	ApiName    string `json:"apiName" gorm:"type:varchar(255);comment:api用户名"`
	ApiKey     string `json:"apiKey" gorm:"type:varchar(255);comment:apiKey"`
	ApiSecret  string `json:"apiSecret" gorm:"type:varchar(255);comment:apiSecret"`
	Passphrase string `json:"passphrase" gorm:"type:varchar(255);comment:api密码"`
	IpAddress  string `json:"ipAddress" gorm:"type:varchar(255);comment:代理地址"`
	UserPass   string `json:"userPass" gorm:"type:varchar(255);comment:代码账号密码"`
	// AdminId     int64  `json:"adminId" gorm:"type:int unsigned;comment:管理员id"`
	Affiliation int64  `json:"affiliation" gorm:"type:int;comment:归属:1=现货,2=合约,3=现货合约"`
	AdminShow   int64  `json:"adminShow" gorm:"type:int;comment:是否超管可见:1=是,0=否"`
	Site        string `json:"site" gorm:"type:enum('1','2','3');comment:允许下单的方向:1=多;2=空;3=多空"`
	Subordinate string `json:"subordinate" gorm:"type:enum('0','1','2');comment:从属关系:0=未绑定关系;1=主账号;2=副帐号"`
	GroupId     int64  `json:"groupId" gorm:"type:int unsigned;comment:所属组id"`
	OpenStatus  int64  `json:"openStatus" gorm:"type:int unsigned;comment:开启状态 0=关闭 1=开启"`

	SpotLastTime    string `json:"spotLastTime" gorm:"-"`    //现货websocket最后通信时间
	FuturesLastTime string `json:"futuresLastTime" gorm:"-"` //合约websocket最后通信时间
	models.ModelTime
	models.ControlBy
}

func (LineApiUser) TableName() string {
	return "line_api_user"
}

func (e *LineApiUser) Generate() models.ActiveRecord {
	o := *e
	return &o
}

func (e *LineApiUser) GetId() interface{} {
	return e.Id
}
