package wx_user

import (
	"time"
)

// WxUser 联系人表
type WxUser struct {
	UserID              uint64    `gorm:"primaryKey;column:user_id;type:bigint(20) unsigned;not null" json:"userId"` // 用户id
	OpenID              string    `gorm:"index:open_id;column:open_id;type:varchar(32)" json:"openId"`               // open_id
	UnionID             string    `gorm:"column:union_id;type:varchar(64)" json:"unionId"`
	Subscribe           int8      `gorm:"column:subscribe;type:tinyint(1)" json:"subscribe"`                                                 // 是否关注
	CompanyID           int64     `gorm:"index:inx_company_id;column:company_id;type:bigint(20)" json:"companyId"`                           // 客户id
	NickName            string    `gorm:"index:nick_name;column:nick_name;type:varchar(32)" json:"nickName"`                                 // 用户昵称
	RealName            string    `gorm:"column:real_name;type:varchar(32)" json:"realName"`                                                 // 用户实际名称
	UserCode            string    `gorm:"column:user_code;type:varchar(32)" json:"userCode"`                                                 // 用户编码
	Mobile              string    `gorm:"column:mobile;type:varchar(32)" json:"mobile"`                                                      // 手机号码
	BindAccount         string    `gorm:"column:bind_account;type:varchar(128);default:''" json:"bindAccount"`                               // 绑定时的账号
	WxCode              string    `gorm:"column:wx_code;type:varchar(32)" json:"wxCode"`                                                     // 微信号
	Profession          string    `gorm:"column:profession;type:varchar(32)" json:"profession"`                                              // 职业
	Email               string    `gorm:"column:email;type:varchar(100)" json:"email"`                                                       // 邮箱
	Telephone           string    `gorm:"column:telephone;type:varchar(32)" json:"telephone"`                                                // 座机
	Sex                 int64     `gorm:"column:sex;type:bigint(20)" json:"sex"`                                                             // 普通用户性别,1为男性,2为女性
	Province            string    `gorm:"index:province;column:province;type:varchar(30)" json:"province"`                                   // 普通用户个人资料填写的省份
	City                string    `gorm:"index:city;column:city;type:varchar(30)" json:"city"`                                               // 普通用户个人资料填写的城市
	Country             string    `gorm:"column:country;type:varchar(30)" json:"country"`                                                    // 国家,如中国为CN
	SubscribeTime       time.Time `gorm:"column:subscribe_time;type:datetime" json:"subscribeTime"`                                          // 关注时间
	Remark              string    `gorm:"column:remark;type:varchar(128)" json:"remark"`                                                     // 备注
	Headimgurl          string    `gorm:"column:headimgurl;type:varchar(512)" json:"headimgurl"`                                             // 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空
	Privilege           string    `gorm:"column:privilege;type:text" json:"privilege"`                                                       // 用户特权信息,json数组,如微信沃卡用户为(chinaunicom)
	Unionid             string    `gorm:"column:unionid;type:varchar(32)" json:"unionid"`                                                    // 用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的。
	FirstLogin          int8      `gorm:"column:first_login;type:tinyint(1);default:1" json:"firstLogin"`                                    // 是否第一次登陆
	Enabled             int8      `gorm:"column:enabled;type:tinyint(1);not null;default:1" json:"enabled"`                                  // 用户状态
	CreatedTime         time.Time `gorm:"index:created_time;column:created_time;type:datetime;default:CURRENT_TIMESTAMP" json:"createdTime"` // 创建时间
	LastUpdatedTime     time.Time `gorm:"index:last_updated_time;column:last_updated_time;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"lastUpdatedTime"`
	Seller              string    `gorm:"column:seller;type:varchar(200)" json:"seller"`                                                  // 销售员
	Note                string    `gorm:"column:note;type:varchar(128)" json:"note"`                                                      // 客户备份信息
	IsNote              int8      `gorm:"column:is_note;type:tinyint(1);default:0" json:"isNote"`                                         // 是否备注过信息
	FromType            string    `gorm:"column:from_type;type:varchar(30);default:report" json:"fromType"`                               // report:研报,teleconference:电话会,advisory:每日资讯,
	ApplyMethod         int8      `gorm:"column:apply_method;type:tinyint(2);default:0" json:"applyMethod"`                               // 0:未申请,1:已付费客户申请试用,2:非客户申请试用
	Position            string    `gorm:"column:position;type:varchar(50);default:''" json:"position"`                                    // 职位
	IsMaker             int8      `gorm:"column:is_maker;type:tinyint(4);default:0" json:"isMaker"`                                       // 是否决策人,1:是,0:否
	BusinessCardURL     string    `gorm:"column:business_card_url;type:varchar(255);default:''" json:"businessCardUrl"`                   // 名片地址
	MobileTwo           string    `gorm:"column:mobile_two;type:varchar(32);default:''" json:"mobileTwo"`                                 // 备用手机号
	DepartmentName      string    `gorm:"column:department_name;type:varchar(50);default:''" json:"departmentName"`                       // 部门名称
	ReportLastViewTime  time.Time `gorm:"column:report_last_view_time;type:datetime" json:"reportLastViewTime"`                           // 最后一次阅读报告时间
	RegisterTime        time.Time `gorm:"column:register_time;type:datetime" json:"registerTime"`                                         // 注册时间
	IsFreeLogin         int8      `gorm:"column:is_free_login;type:tinyint(4)" json:"isFreeLogin"`                                        // 是否30天免登陆
	LoginTime           time.Time `gorm:"column:login_time;type:datetime" json:"loginTime"`                                               // 登录时间
	RegisterPlatform    int8      `gorm:"column:register_platform;type:tinyint(4);default:1" json:"registerPlatform"`                     // 注册平台,1:微信端,2:网页端,3:管理后台,4:小程序端
	SessionKey          string    `gorm:"column:session_key;type:varchar(255)" json:"sessionKey"`                                         // 微信小程序会话密钥
	CountryCode         string    `gorm:"column:country_code;type:varchar(255);default:''" json:"countryCode"`                            // 区号
	IsRegister          int8      `gorm:"column:is_register;type:tinyint(4)" json:"isRegister"`                                           // 是否注册:1:已注册,0:未注册
	Source              int8      `gorm:"column:source;type:tinyint(4);default:0" json:"source"`                                          // 来源,1:微信端,2:pc网页端,3:查研观向小程序,4:每日咨询,5:电话会
	IsDeal              uint8     `gorm:"column:is_deal;type:tinyint(2) unsigned;default:0" json:"isDeal"`                                // 是否标记处理,0是未处理,1是已处理
	OutboundMobile      string    `gorm:"index:outbound_mobile;column:outbound_mobile;type:varchar(30);default:''" json:"outboundMobile"` // 外呼手机号
	OutboundCountryCode string    `gorm:"column:outbound_country_code;type:varchar(10);default:''" json:"outboundCountryCode"`            // 外呼手机号区号
	IsMsgOutboundMobile int8      `gorm:"column:is_msg_outbound_mobile;type:tinyint(1);not null;default:0" json:"isMsgOutboundMobile"`    // 是否弹窗过绑定过外呼手机号
	QaAvatarUrl         string    `gorm:"column:qa_avatar_url;type:varchar(255);not null;default:''" json:"qaAvatarUrl"`   // 问答社区头像
}

// TableName get sql table name.获取数据库表名
func (wxUser *WxUser) TableName() string {
	return "wx_user"
}

// WxUserColumns get sql column name.获取数据库列名
var WxUserColumns = struct {
	UserID              string
	OpenID              string
	UnionID             string
	Subscribe           string
	CompanyID           string
	NickName            string
	RealName            string
	UserCode            string
	Mobile              string
	BindAccount         string
	WxCode              string
	Profession          string
	Email               string
	Telephone           string
	Sex                 string
	Province            string
	City                string
	Country             string
	SubscribeTime       string
	Remark              string
	Headimgurl          string
	Privilege           string
	Unionid             string
	FirstLogin          string
	Enabled             string
	CreatedTime         string
	LastUpdatedTime     string
	Seller              string
	Note                string
	IsNote              string
	FromType            string
	ApplyMethod         string
	Position            string
	IsMaker             string
	BusinessCardURL     string
	MobileTwo           string
	DepartmentName      string
	ReportLastViewTime  string
	RegisterTime        string
	IsFreeLogin         string
	LoginTime           string
	RegisterPlatform    string
	SessionKey          string
	CountryCode         string
	IsRegister          string
	Source              string
	IsDeal              string
	OutboundMobile      string
	OutboundCountryCode string
	IsMsgOutboundMobile string
}{
	UserID:              "user_id",
	OpenID:              "open_id",
	UnionID:             "union_id",
	Subscribe:           "subscribe",
	CompanyID:           "company_id",
	NickName:            "nick_name",
	RealName:            "real_name",
	UserCode:            "user_code",
	Mobile:              "mobile",
	BindAccount:         "bind_account",
	WxCode:              "wx_code",
	Profession:          "profession",
	Email:               "email",
	Telephone:           "telephone",
	Sex:                 "sex",
	Province:            "province",
	City:                "city",
	Country:             "country",
	SubscribeTime:       "subscribe_time",
	Remark:              "remark",
	Headimgurl:          "headimgurl",
	Privilege:           "privilege",
	Unionid:             "unionid",
	FirstLogin:          "first_login",
	Enabled:             "enabled",
	CreatedTime:         "created_time",
	LastUpdatedTime:     "last_updated_time",
	Seller:              "seller",
	Note:                "note",
	IsNote:              "is_note",
	FromType:            "from_type",
	ApplyMethod:         "apply_method",
	Position:            "position",
	IsMaker:             "is_maker",
	BusinessCardURL:     "business_card_url",
	MobileTwo:           "mobile_two",
	DepartmentName:      "department_name",
	ReportLastViewTime:  "report_last_view_time",
	RegisterTime:        "register_time",
	IsFreeLogin:         "is_free_login",
	LoginTime:           "login_time",
	RegisterPlatform:    "register_platform",
	SessionKey:          "session_key",
	CountryCode:         "country_code",
	IsRegister:          "is_register",
	Source:              "source",
	IsDeal:              "is_deal",
	OutboundMobile:      "outbound_mobile",
	OutboundCountryCode: "outbound_country_code",
	IsMsgOutboundMobile: "is_msg_outbound_mobile",
}