package model

import "iot_manager_service/app/multimedia/dao"

const (
	LibraryTypeVideo    = 1
	LibraryTypeImage    = 2
	LibraryTypeTxt      = 3
	LibraryTypeAudio    = 4
	LibraryTypeVideoStr = "视频"
	LibraryTypeImageStr = "图片"
	LibraryTypeTxtStr   = "文本"
	LibraryTypeAudioStr = "音频"
)

func LibToModel(library dao.Library) LibraryDetail {
	typeName := ""
	switch library.LibType {
	case LibraryTypeVideo:
		typeName = LibraryTypeVideoStr
	case LibraryTypeImage:
		typeName = LibraryTypeImageStr
	case LibraryTypeTxt:
		typeName = LibraryTypeTxtStr
	case LibraryTypeAudio:
		typeName = LibraryTypeAudioStr
	}

	return LibraryDetail{
		Library:  library,
		TypeName: typeName,
	}
}

type LibraryDetail struct {
	dao.Library
	TypeName string `json:"typeName"` //素材类型(中文) 视频 图片
}

type RsqLibraryList struct {
	Records []LibraryDetail `json:"records"` //记录列表
	Current int             `json:"current"` //当前分页
	Size    int             `json:"size"`    //每页数量
	Pages   int             `json:"pages"`   //总页数
	Total   int             `json:"total"`   //总数
}

type RspUploadFile struct {
	Link         string `json:"link"`
	Domain       string `json:"domain"`
	Name         string `json:"name"`
	OriginalName string `json:"originalName"`
	AttachId     int    `json:"attachId"`
	Duration     int    `json:"duration"`
	Resolution   string `json:"resolution"`
	FileSize     int64  `json:"fileSize"`
	FileType     int    `json:"fileType"`
}

type ReqLibrarySubmit struct {
	Id              int    `json:"id"`
	FileSize        int64  `json:"fileSize"`
	LibName         string `json:"libName"`
	Resolution      string `json:"resolution"`
	MaterialAddress string `json:"materialAddress"`
	LibType         int    `json:"libType"`
	LibDuration     int    `json:"libDuration"`
	LibExplain      string `json:"libExplain"`
	TalkSpeed       int    `json:"talkSpeed"`
}
