package model

import (
	"gorm.io/gorm"
)

// Shop 店铺模型
type Shop struct {
	gorm.Model
	BaseModel              `gorm:"embedded"`
	ShopName               string `gorm:"column:shop_name;type:varchar(100);not null;comment:店铺名称" json:"shop_name"`
	ShopCode               string `gorm:"column:shop_code;type:varchar(50);uniqueIndex:idx_shop_code,where:deleted_at IS NULL;comment:店铺编号" json:"shop_code"`
	ParentID               *uint  `gorm:"column:parent_id;index;comment:上级店铺ID（NULL表示一级代理）" json:"parent_id,omitempty"`
	BusinessOwnerAccountID *uint  `gorm:"column:business_owner_account_id;index:idx_shop_business_owner_account_id;comment:平台业务员账号ID" json:"business_owner_account_id,omitempty"`
	Level                  int    `gorm:"column:level;type:int;not null;default:1;comment:层级（1-7）" json:"level"`
	ContactName            string `gorm:"column:contact_name;type:varchar(50);comment:联系人姓名" json:"contact_name"`
	ContactPhone           string `gorm:"column:contact_phone;type:varchar(20);comment:联系人电话" json:"contact_phone"`
	Province               string `gorm:"column:province;type:varchar(50);comment:省份" json:"province"`
	City                   string `gorm:"column:city;type:varchar(50);comment:城市" json:"city"`
	District               string `gorm:"column:district;type:varchar(50);comment:区县" json:"district"`
	Address                string `gorm:"column:address;type:varchar(255);comment:详细地址" json:"address"`
	Status                 int    `gorm:"column:status;type:int;not null;default:1;comment:状态 0=禁用 1=启用" json:"status"`
	ClientLoginDisabled    bool   `gorm:"column:client_login_disabled;type:boolean;not null;default:false;comment:是否禁止该店铺资产发起新的C端登录" json:"client_login_disabled"`
}

// TableName 指定表名
func (Shop) TableName() string {
	return "tb_shop"
}
