/*
 * @description:标段
 * @Author: CP
 * @Date: 2020-09-28 10:56:55
 * @FilePath: \construction_management\web\viewmodels\bidsection.go
 */
package viewmodels

import (
	validation "github.com/go-ozzo/ozzo-validation/v3"
)

type Bidsection struct {
	Id         string `form:"id" json:"id"`
	Name       string `form:"name" json:"name"`
	ProjectId  string `form:"projectId" json:"projectId"`
	CreateTime string `form:"createTime" json:"createTime"`
	FolderId   string `form:"folderId" json:"folderId"`
	// Status   int    `xorm:"comment('状态') TINYINT(1)"`
	// UserId   int    `xorm:"comment('用户id') INT(11)"`
	// Category string `xorm:"comment('分类属性') VARCHAR(1024)"`

	// Type         int    `xorm:"comment('标段类型') TINYINT(2)"`
	// LedgerTimes  int    `xorm:"not null default 0 comment('台账审批次数') TINYINT(4)"`
	// LedgerStatus int    `xorm:"not null default 1 comment('台账审批状态') TINYINT(4)"`
	// MRule        string `xorm:"VARCHAR(1024)"`
	// Times        int    `xorm:"comment('审批次数') TINYINT(4)"`
	// CRule        string `xorm:"comment('变更令-规则') VARCHAR(1024)"`
	// CConnector   int    `xorm:"comment('变更令-连接符') TINYINT(4)"`
	// CRuleFirst   int    `xorm:"comment('变更令规则第一次出现') TINYINT(1)"`
	// MeasureType  string `xorm:"VARCHAR(11)"`
	// SImType      string `xorm:"comment('期，中间计量，模式') VARCHAR(11)"`
	// Cooperation  string `xorm:"comment('协作人员和功能列表') TEXT"`
	// Valuation    int    `xorm:"comment('计价规范') TINYINT(4)"`
	// TotalPrice   string `xorm:"comment('0号台账 -- 金额') DECIMAL(12,2)"`
	// DealTp       string `xorm:"comment('签约 -- 金额') DECIMAL(12,2)"`
	// Uuid         string `xorm:"comment('更新时间') VARCHAR(64)"`
}

func (l Bidsection) Validate() error {
	return validation.ValidateStruct(&l,
		// Code cannot be empty, and the length must between 5 and 50
		validation.Field(&l.Name, validation.Required.Error("标段名称不能为空"), validation.Length(2, 128).Error("项目编号最少要输入 2 个字符")),
		validation.Field(&l.FolderId, validation.Required.Error("目录ID不能为空")),
	)
}
