// Package model -----------------------------
// @file      : artshow.go
// @author    : JJXu
// @contact   : wavingbear@163.com
// @time      : 2023/3/2 9:32
// -------------------------------------------
package model

type ArtshowArtistSupplement struct {
	Model
	//通过这两个字段弱关联 artwork_lock_record表中对应的画作
	ArtistUid string `json:"artistUid" gorm:"column:artist_uid;comment:"`
	Status    int64  `json:"status" gorm:"column:status;default:2;comment:2=锁定 3=解锁"` //跟随用户的锁定和解锁状态,用于控制数据的展示
	LockTime  string `json:"lockTime" gorm:"column:lock_time;comment:"`

	//审批字段
	AuditStatus AuditStatus `json:"auditStatus" gorm:"column:audit_status;comment:审核状态：2= 待审核,3= 审核失败,4= 审核通过,5= 待补充"`
	AuditMark1  string      `json:"auditMark1" gorm:"column:audit_mark1;comment:审核备注1"`
	AuditMark2  string      `json:"auditMark2" gorm:"column:audit_mark2;comment:审核备注2"`

	ArtistName      string `json:"artistName" gorm:"column:artist_name;comment:"`
	ArtistProfile   string `json:"artistProfile" gorm:"column:artist_profile;comment:个人简介"`
	CountryArtLevel int64  `json:"countryArtLevel" gorm:"column:country_art_level;default:1;comment:国家美术师级别: 1=无  2=1级 3=2级"`
	ArtistCertPic   string `json:"artistCertPic" gorm:"column:artist_cert_pic;comment:国家美术师证书"`
	BankNum         string `json:"bank_num" gorm:"column:bank_num;comment:开户行"`
	BankName        string `json:"bank_name" gorm:"column:bank_name;comment:银行卡账号"`
}

func (a ArtshowArtistSupplement) TableName() string {
	return "artshow_artist_supplement"
}
func (a *ArtshowArtistSupplement) Editable() bool {
	if a.Status == 1 {
		return true
	}
	if a.Status == 2 && (a.AuditStatus == AuditType_Failed || a.AuditStatus == AuditType_Pending || a.AuditStatus == AuditType_Supplemented) {
		return true
	}
	return false
}
