package company_product

import "time"

// CompanyProduct [...]
type CompanyProduct struct {
	CompanyProductID int       `gorm:"primaryKey;column:company_product_id;type:int(11);not null" json:"-"`
	CompanyID        int       `gorm:"uniqueIndex:idx_company_id_product_id;column:company_id;type:int(11);default:0" json:"companyId"` // 客户id
	ProductID        int       `gorm:"uniqueIndex:idx_company_id_product_id;column:product_id;type:int(11);default:0" json:"productId"` // 产品id
	ProductName      string    `gorm:"column:product_name;type:varchar(30);default:''" json:"productName"`
	CompanyName      string    `gorm:"column:company_name;type:varchar(100);default:''" json:"companyName"`                   // 客户名称
	Source           string    `gorm:"column:source;type:varchar(100);default:''" json:"source"`                              // 来源
	Reasons          string    `gorm:"column:reasons;type:varchar(255);default:''" json:"reasons"`                            // 新增理由
	Status           string    `gorm:"column:status;type:enum('试用','永续','冻结','流失','正式','潜在')" json:"status"`                  // 客户状态
	IndustryID       int       `gorm:"column:industry_id;type:int(11)" json:"industryId"`                                     // 行业id
	IndustryName     string    `gorm:"column:industry_name;type:varchar(50);default:''" json:"industryName"`                  // 行业名称
	SellerID         int       `gorm:"column:seller_id;type:int(11);default:0" json:"sellerId"`                               // 所属销售id
	SellerName       string    `gorm:"column:seller_name;type:varchar(50);default:''" json:"sellerName"`                      // 所属销售名称
	GroupID          int       `gorm:"column:group_id;type:int(11);default:0" json:"groupId"`                                 // 所属销售分组id
	DepartmentID     int       `gorm:"column:department_id;type:int(11);default:0" json:"departmentId"`                       // 所属销售部门id
	IsSuspend        int8      `gorm:"primaryKey;column:is_suspend;type:tinyint(4);not null;default:0" json:"-"`              // 1:暂停,0:启用
	SuspendTime      time.Time `gorm:"column:suspend_time;type:datetime" json:"suspendTime"`                                  // 暂停/启用时间
	TryOutTime       time.Time `gorm:"column:try_out_time;type:datetime" json:"tryOutTime"`                                   // 正式转试用时间
	RenewalReason    string    `gorm:"column:renewal_reason;type:varchar(255);default:''" json:"renewalReason"`               // 正式转试用后的续约情况说明
	FreezeTime       time.Time `gorm:"column:freeze_time;type:datetime" json:"freezeTime"`                                    // 冻结时间
	FreezeReason     string    `gorm:"column:freeze_reason;type:varchar(255);default:''" json:"freezeReason"`                 // 冻结理由
	Remark           string    `gorm:"column:remark;type:varchar(255);default:''" json:"remark"`                              // 备注信息
	StartDate        time.Time `gorm:"column:start_date;type:date" json:"startDate"`                                          // 开始日期
	EndDate          time.Time `gorm:"column:end_date;type:date" json:"endDate"`                                              // 结束日期
	ContractEndDate  time.Time `gorm:"index:idx_contract_end_date;column:contract_end_date;type:date" json:"contractEndDate"` // 合同结束日期
	CreateTime       time.Time `gorm:"column:create_time;type:datetime" json:"createTime"`                                    // 创建时间
	ModifyTime       time.Time `gorm:"column:modify_time;type:datetime" json:"modifyTime"`                                    // 修改时间
	LoseReason       string    `gorm:"column:lose_reason;type:varchar(255);default:''" json:"loseReason"`                     // 流失原因
	LossTime         time.Time `gorm:"column:loss_time;type:datetime" json:"lossTime"`                                        // 流失时间
	ApproveStatus    string    `gorm:"column:approve_status;type:enum('待审批','已审批','驳回','已撤回')" json:"approveStatus"`          // 审批状态
	CompanyType      string    `gorm:"column:company_type;type:varchar(20);default:''" json:"companyType"`                    // 客户类型:ficc,权益，合作伙伴
	FreezeStartDate  time.Time `gorm:"column:freeze_start_date;type:date" json:"freezeStartDate"`                             // 冻结开始日期
	FreezeEndDate    time.Time `gorm:"column:freeze_end_date;type:date" json:"freezeEndDate"`                                 // 冻结结束日期
	CustomType       int8      `gorm:"column:custom_type;type:tinyint(4);default:0" json:"customType"`                        // 1:合作伙伴，2：公募，3：私募
	FormalTime       time.Time `gorm:"column:formal_time;type:datetime" json:"formalTime"`                                    // 转正时间
	OpenCode         string    `gorm:"column:open_code;type:varchar(64);default:''" json:"openCode"`                          // 开放给第三方的编码，不让第三方定位我们的客户信息
}

// TableName get sql table name.获取数据库表名
func (m *CompanyProduct) TableName() string {
	return "company_product"
}

// CompanyProductColumns get sql column name.获取数据库列名
var CompanyProductColumns = struct {
	CompanyProductID string
	CompanyID        string
	ProductID        string
	ProductName      string
	CompanyName      string
	Source           string
	Reasons          string
	Status           string
	IndustryID       string
	IndustryName     string
	SellerID         string
	SellerName       string
	GroupID          string
	DepartmentID     string
	IsSuspend        string
	SuspendTime      string
	TryOutTime       string
	RenewalReason    string
	FreezeTime       string
	FreezeReason     string
	Remark           string
	StartDate        string
	EndDate          string
	ContractEndDate  string
	CreateTime       string
	ModifyTime       string
	LoseReason       string
	LossTime         string
	ApproveStatus    string
	CompanyType      string
	FreezeStartDate  string
	FreezeEndDate    string
	CustomType       string
	FormalTime       string
	OpenCode         string
}{
	CompanyProductID: "company_product_id",
	CompanyID:        "company_id",
	ProductID:        "product_id",
	ProductName:      "product_name",
	CompanyName:      "company_name",
	Source:           "source",
	Reasons:          "reasons",
	Status:           "status",
	IndustryID:       "industry_id",
	IndustryName:     "industry_name",
	SellerID:         "seller_id",
	SellerName:       "seller_name",
	GroupID:          "group_id",
	DepartmentID:     "department_id",
	IsSuspend:        "is_suspend",
	SuspendTime:      "suspend_time",
	TryOutTime:       "try_out_time",
	RenewalReason:    "renewal_reason",
	FreezeTime:       "freeze_time",
	FreezeReason:     "freeze_reason",
	Remark:           "remark",
	StartDate:        "start_date",
	EndDate:          "end_date",
	ContractEndDate:  "contract_end_date",
	CreateTime:       "create_time",
	ModifyTime:       "modify_time",
	LoseReason:       "lose_reason",
	LossTime:         "loss_time",
	ApproveStatus:    "approve_status",
	CompanyType:      "company_type",
	FreezeStartDate:  "freeze_start_date",
	FreezeEndDate:    "freeze_end_date",
	CustomType:       "custom_type",
	FormalTime:       "formal_time",
	OpenCode:         "open_code",
}
