/*
 * @description: 后台模板
 * @Author: CP
 * @Date: 2021-02-18 10:07:58
 * @FilePath: \construction_management\web\viewmodels\backstage.go
 */
package viewmodels

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

// cld相关
type StaffCld struct {
	Id         string `from:"id" json:"id"`
	StaffId    string `from:"staffId" json:"staffId"`
	StaffName  string `from:"staffName" json:"staffName"`
	Password   string `from:"password" json:"password"`
	CategoryId string `from:"categoryId" json:"categoryId"`
	Category   string `from:"category" json:"category"`
}

// 接收CLD
type ResultCld struct {
	UserName string `from:"username" json:"username"`
	Category string `from:"category" json:"category"`
}

func (l StaffCld) ValidateLogin() error {
	return validation.ValidateStruct(&l,
		validation.Field(&l.StaffName, validation.Required.Error("CLD账号不能为空")),
		validation.Field(&l.Password, validation.Required.Error("密码不能为空"), validation.Length(6, 18).Error("密码位数6~18之间")),
	)
}
