package model

import operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"

type CancelDistributeFeedFormulaRequest struct {
	PastureId     int64   `json:"pasture_id"`
	PastureDataId []int64 `json:"pasture_data_id"`
}

type PastureResponse struct {
	Code int32       `json:"code"`
	Msg  string      `json:"msg"`
	Data interface{} `json:"data"`
}

type PastureSuccess struct {
	Success bool `json:"success"`
}

type DashboardAccuracyRequest struct {
	CattleParentCategoryId int32  `json:"cattle_parent_category_id,omitempty"`
	FeedFormulaId          int32  `json:"feed_formula_id"`
	StartDate              string `json:"start_date"`
	EndDate                string `json:"end_date"`
	PastureId              int32  `json:"pasture_id"`
}

type FeedFormulaIsModifyRequest struct {
	PastureId     int64 `json:"pasture_id"`
	FeedFormulaId int64 `json:"feed_formula_id"`
	IsModify      int32 `json:"is_modify"`
}

type PastureAnalysisAccuracyResponse struct {
	Code int32                        `json:"code"`
	Msg  string                       `json:"msg"`
	Data *PastureAnalysisAccuracyData `json:"data"`
}
type PastureAnalysisAccuracyData struct {
	MixedFodderAccurateRatio    []*PastureAnalysisAccuracyDataValue `json:"mixed_fodder_accurate_ratio"`    // 混料准确率
	MixedFodderCorrectRatio     []*PastureAnalysisAccuracyDataValue `json:"mixed_fodder_correct_ratio"`     // 混料正确率
	SprinkleFodderAccurateRatio []*PastureAnalysisAccuracyDataValue `json:"sprinkle_fodder_accurate_ratio"` // 撒料准确率
	SprinkleFodderCorrectRatio  []*PastureAnalysisAccuracyDataValue `json:"sprinkle_fodder_correct_ratio"`  // 撒料正确率
}

type PastureAnalysisAccuracyDataValue struct {
	DayTime string  `json:"day_time"`
	Ratio   float64 `json:"ratio"`
}

type AccountDistribution struct {
	Account     string `json:"account"`
	UserName    string `json:"user_name"`
	Password    string `json:"password"`
	Phone       string `json:"phone"`
	PastureId   int32  `json:"pasture_id"`
	PastureName string `json:"pasture_name"`
	Address     string `json:"address"`
}

type CategoryRequest struct {
	PastureId  int32  `json:"pasture_id"`
	ParentId   int32  `json:"parent_id"`
	ParentName string `json:"parent_name"`
	Name       string `json:"name"`
	Number     string `json:"number"`
	IsShow     int32  `json:"is_show"`
	GroupId    int32  `json:"group_id"`
}

type CategoryDeleteRequest struct {
	PastureId int32 `json:"pasture_id"`
	GroupId   int32 `json:"group_id"`
	IsDelete  int32 `json:"is_delete"`
}

type FeedFormulaListRequest struct {
	PastureId int32 `json:"pasture_id"`
	Page      int32 `json:"page"`
	PageSize  int32 `json:"page_size"`
}

type FeedFormulaListResponse struct {
	Code int32            `json:"code"`
	Msg  string           `json:"msg"`
	Data *FeedFormulaData `json:"data"`
}

type FeedFormulaData struct {
	Total    int32           `json:"total"`
	Page     int32           `json:"page"`
	PageSize int32           `json:"page_size"`
	List     []*FeedTemplate `json:"list"`
}

type FeedTemplate struct {
	Id           int64   `json:"id"`
	PastureId    int64   `json:"pasture_id"`
	TCode        string  `json:"t_code"`
	TName        string  `json:"t_name"`
	TColor       string  `json:"t_color"`
	CCid         int64   `json:"c_cid"`
	CCName       string  `json:"cc_name"`
	FTType       string  `json:"ft_type"`
	FTTypeId     int32   `json:"ft_type_id"`
	Source       string  `json:"source"`
	Remark       string  `json:"remark"`
	Enable       int32   `json:"enable"`
	Sort         int64   `json:"sort"`
	Owner        string  `json:"owner"`
	Weight       float64 `json:"weight"`
	DryWeight    float64 `json:"dry_weight"`
	IsDelete     int32   `json:"is_delete"`
	Version      int64   `json:"version"`
	SaveTime     string  `json:"save_time"`
	IsIssue      int32   `json:"is_issue"`
	IssueVersion int32   `json:"issue_version"`
	IssueId      int64   `json:"issue_id"`
	Backup1      string  `json:"backup1"`
	Backup2      string  `json:"backup2"`
	IsModify     int32   `json:"is_modify"`
}

// MixedCategoryTmrNameParams tmr名称和混料类别
type MixedCategoryTmrNameParams struct {
	PastureId string `json:"pastureid"` //牧场id
	StartTime string `json:"startdate,omitempty"`
	EndTime   string `json:"enddate,omitempty"`
}

type FeedListResponse struct {
	Code int32     `json:"code"`
	Msg  string    `json:"msg"`
	Data *FeedData `json:"data"`
}

type FeedData struct {
	Total    int32   `json:"total"`
	Page     int32   `json:"page"`
	PageSize int32   `json:"page_size"`
	List     []*Feed `json:"list"`
}

type Feed struct {
	Id             int64   `xorm:"id" json:"id"`
	PastureId      int64   `xorm:"pastureid" json:"pasture_id"`
	FeedCode       string  `xorm:"feedcode" json:"feed_code"`
	FName          string  `xorm:"fname" json:"f_name"`
	FClass         string  `xorm:"fclass" json:"f_class"`
	FClassId       int64   `xorm:"fclassid" json:"f_class_id"`
	AllowRatio     int64   `xorm:"allowratio" json:"allow_ratio"`
	PrintGroupId   int64   `xorm:"printgroupid" json:"print_group_id"`
	PrintGroup     string  `xorm:"printgroup" json:"print_group"`
	UnitWeight     int64   `xorm:"unitweight" json:"unit_weight"`
	UPrice         float64 `xorm:"uprice" json:"u_price"`
	Dry            float64 `xorm:"dry" json:"dry"`
	AutoZone       int64   `xorm:"autozone" json:"auto_zone"`
	AutoSecond     int64   `xorm:"autosecond" json:"auto_second"`
	AutoSecondName string  `xorm:"autosecondname" json:"auto_second_name"`
	ConfirmStart   int32   `xorm:"confirmstart" json:"confirm_start"`
	TrgAddress     int32   `xorm:"trgaddress" json:"trg_address"`
	SmtMrId        int64   `xorm:"smt_mr_id" json:"smt_mr_id"`
	SmtMrName      string  `xorm:"smtmrname" json:"smt_mr_name"`
	Sort           int32   `xorm:"sort" json:"sort"`
	Enable         int32   `xorm:"enable" json:"enable"`
	Jmp            int32   `xorm:"jmp" json:"jmp"`
	Source         string  `xorm:"source"`
	Backup1        string  `xorm:"backup1" json:"backup1"`
	Backup2        string  `xorm:"backup2" json:"backup2"`
	Backup3        string  `xorm:"backup3" json:"backup3"`
}

type FeedFormulaDetailListResponse struct {
	Code int32                  `json:"code"`
	Msg  string                 `json:"msg"`
	Data *FeedFormulaDetailData `json:"data"`
}

type FeedFormulaDetailData struct {
	Total    int32                 `json:"total"`
	Page     int32                 `json:"page"`
	PageSize int32                 `json:"page_size"`
	List     []*FeedTemplateDetail `json:"list"`
}

type FeedTemplateDetail struct {
	Id             int64   `json:"id"`
	PastureId      int64   `json:"pasture_id"`
	FtId           int64   `json:"ft_id"`
	FId            int64   `json:"f_id"`
	FName          string  `json:"f_name"`
	LWeight        float64 `json:"l_weight"`
	FWeight        float64 `json:"f_weight"`
	IsLockCount    int32   `json:"is_lock_count"`
	IsFg           int32   `json:"is_fg"`
	Sort           int32   `json:"sort"`
	FeedGroup      string  `json:"feed_group"`
	PreFtId        int64   `json:"pre_ft_id"`
	AutoSecond     int32   `json:"auto_second"`
	AutoSecondName string  `json:"auto_second_name"`
	SplitFtPreId   int64   `json:"split_ft_pre_id"`
	Deviation      int32   `json:"deviation"`
}

type FeedFormulaUpdateVersionRequest struct {
	FeedTemplateId int64                               `json:"feed_template_id"` // 配方id
	Version        int64                               `json:"version"`          // 版本号
	Belong         int32                               `json:"belong"`           // 配方归属  0 无效 1 归属集团端 2 归属牧场端
	Data           []*operationPb.AddFeedFormulaDetail `json:"data"`
}

type FeedFormulaUpdateVersionResponse struct {
	Code int32  `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		Success bool `json:"success"`
	} `json:"data"`
}