/*
 * @description:合同目录视图模型
 * @Author: CP
 * @Date: 2020-10-27 17:07:50
 * @FilePath: \construction_management\web\viewmodels\folder_contract.go
 */
package viewmodels

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

type FolderContract struct {
	Id           string `form:"id" json:"id" `
	Name         string `form:"name" json:"name"`
	ProjectId    string `form:"projectId" json:"projectId"`
	BidsectionId string `form:"bidsectionId" json:"bidsectionId"`
	ParentId     string `form:"parentId" json:"parentId"`
	Isfolder     int    `form:"isfolder" json:"isfolder"`

	Contracts               int    `form:"contracts" json:"contracts"`
	ContractsIncome         string `form:"contractsIncome" json:"contractsIncome"`
	ContractsReturned       string `form:"contractsReturned" json:"contractsReturned"`
	ContractsIncomeProgress string `form:"contractsIncomeProgress" json:"contractsIncomeProgress"`
	ContractsPay            string `form:"contractsPay" json:"contractsPay"`
	ContractsPaid           string `form:"contractsPaid" json:"contractsPaid"`
	ContractsPayProgress    string `form:"contractsPayProgress" json:"contractsPayProgress"`

	// 安全巡检字段-后期做接口后移动-TODO
	SafeTotal           int `form:"safeTotal" json:"safeTotal"`
	SafeRectification   int `form:"safeRectification" json:"safeRectification"`
	SafeRectificationIn int `form:"safeRectificationIn" json:"safeRectificationIn"`

	Csrf string `form:"csrf" json:"csrf"`
	// Leaf        bool    `json:"leaf" `
	HasFolder   bool              `json:"hasFolder" `
	IsBid       bool              `json:"isBid" `
	IsEnd       bool              `json:"isEnd"`
	ChildsTotal int               `json:"childsTotal"`
	Children    []*FolderContract `json:"children"`
}

func (l FolderContract) Validate() error {
	return validation.ValidateStruct(&l,
		validation.Field(&l.Id, validation.Required.Error("文件夹ID不能为空")),
		validation.Field(&l.Name, validation.Required.Error("文件夹名称不能为空"), validation.Length(1, 60).Error("最多 15 个字符")),
	)
}

// Depth          int    `form:"depth" json:"depth"`
// Serial         string `form:"serial" json:"serial"`
// Attribution    string `form:"attribution" json:"attribution"`

// CreateTime     string `form:"createTime" json:"createTime"`
// UpdateTime     string `form:"updateTime" json:"updateTime"`
// TargetFolderId string `form:"targetFolderId" json:"targetFolderId"`
// Ancounts       int    `form:"ancounts" json:"ancounts"`
