package response

import (
	excel2 "eta/eta_api/models/data_manage/excel"
	"eta/eta_api/models/data_manage/excel/request"
	"eta/eta_api/services/excel"
	"github.com/rdlucklib/rdluck_tools/paging"
	"time"
)

// AddExcelInfoResp 添加excel表格的返回
type AddExcelInfoResp struct {
	ExcelInfoId int    `description:"表格id"`
	UniqueCode  string `description:"表格唯一编码"`
}

// ExcelListResp 表格列表返回数据
type ExcelListResp struct {
	Paging *paging.PagingItem
	List   []*excel2.MyExcelInfoList
}

// ExcelTableDetailResp  excel表格详情
type ExcelTableDetailResp struct {
	UniqueCode string `description:"表格唯一code"`
	ExcelImage string `description:"表格截图"`
	ExcelName  string `description:"表格名称"`
	TableInfo  excel.TableData
	Config     ExcelTableDetailConfigResp
}

// ExcelTableDetailConfigResp
// @Description: Excel表格的配置信息
type ExcelTableDetailConfigResp struct {
	FontSize int
}

// TableCellResp 单元格
type TableCellResp struct {
	DataType  int    `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算"`
	DataTime  string `description:"所属日期"`
	ShowValue string `description:"展示的值"`
	Value     string `description:"实际值(计算公式)"`
}

type TableDataItem struct {
	EdbInfoId int                     `description:"指标id"`
	Data      []request.ManualDataReq `description:"数据列表"`
}

// TableDetailResp  excel表格详情
type TableDetailResp struct {
	ExcelInfo excel2.ExcelInfo     `description:"表格基础信息"`
	TableData request.TableDataReq `description:"表格内容"`
}

// ExcelInfoDetail excel表格详情(前端使用)
type ExcelInfoDetail struct {
	ExcelInfoId      int                   `orm:"column(excel_info_id);pk"`
	Source           int                   `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
	ExcelType        int                   `description:"表格类型,1:指标列,2:日期列,默认:1"`
	ExcelName        string                `description:"表格名称"`
	UniqueCode       string                `description:"表格唯一编码"`
	ExcelClassifyId  int                   `description:"表格分类id"`
	SysUserId        int                   `description:"操作人id"`
	SysUserRealName  string                `description:"操作人真实姓名"`
	Content          string                `description:"表格内容"`
	ExcelImage       string                `description:"表格图片"`
	FileUrl          string                `description:"表格下载地址"`
	Sort             int                   `description:"排序字段,数字越小越排前面"`
	IsDelete         int                   `description:"是否删除,0:未删除,1:已删除"`
	ModifyTime       time.Time             `description:"最近修改日期"`
	CreateTime       time.Time             `description:"创建日期"`
	TableData        interface{}           `description:"表格内容"`
	Button           ExcelInfoDetailButton `description:"操作权限"`
	CanEdit          bool                  `description:"是否可编辑"`
	Editor           string                `description:"编辑人"`
	IsJoinPermission int                   `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
	HaveOperaAuth    bool                  `description:"是否有数据权限"`
}

// ExcelInfoDetailButton 操作按钮
type ExcelInfoDetailButton struct {
	RefreshButton    bool `description:"是否可刷新"`
	CopyButton       bool `description:"是否可另存为"`
	DownloadButton   bool `description:"是否可下载"`
	OpButton         bool `description:"是否可编辑"`
	DeleteButton     bool `description:"是否可删除"`
	OpEdbButton      bool `description:"是否可生成指标"`
	RefreshEdbButton bool `description:"是否可刷新指标"`
}