package dto

import "time"

type MediaResponse struct {
	ID        uint      `json:"ID"`
	CreatedAt time.Time `json:"CreatedAt"`
	UpdatedAt time.Time `json:"UpdatedAt"`
	// The compatible model embeds gorm.DeletedAt with json:"-", so this field is omitted.
	DeletedAt any    `json:"-"`
	Name      string `json:"name"`
	ClassID   int    `json:"classId"`
	URL       string `json:"url"`
	Tag       string `json:"tag"`
	Key       string `json:"key"`
	Size      int64  `json:"size"`
	Mime      string `json:"mime"`
	MD5       string `json:"md5"`
	UserID    uint   `json:"userId"`
}

type MediaCategoryResponse struct {
	ID        uint                     `json:"ID"`
	CreatedAt time.Time                `json:"CreatedAt"`
	UpdatedAt time.Time                `json:"UpdatedAt"`
	DeletedAt any                      `json:"-"`
	Name      string                   `json:"name"`
	PID       uint                     `json:"pid"`
	Children  []*MediaCategoryResponse `json:"children"`
}

type StorageObjectResponse struct {
	Key          string    `json:"Key"`
	Size         int64     `json:"Size"`
	LastModified time.Time `json:"LastModified"`
	ContentType  string    `json:"ContentType"`
}

type InitUploadResponse struct {
	Instant        bool           `json:"instant"`
	UploadID       uint           `json:"uploadId"`
	UploadedChunks []int          `json:"uploadedChunks"`
	Media          *MediaResponse `json:"media,omitempty"`
}

type MediaListRequest struct {
	Page           int       `json:"page"`
	PageSize       int       `json:"pageSize"`
	Keyword        string    `json:"keyword"`
	ClassID        int       `json:"classId"`
	Tag            string    `json:"tag"`
	UserID         uint      `json:"userId"`
	StartCreatedAt time.Time `json:"startCreatedAt"`
	EndCreatedAt   time.Time `json:"endCreatedAt"`
	OrderKey       string    `json:"orderKey"`
	Desc           bool      `json:"desc"`
}
type IDRequest struct {
	ID uint `json:"ID" form:"id"`
}
type IDsRequest struct {
	IDs []uint `json:"ids"`
}
type MediaBatchDeleteRequest struct {
	IDs []uint `json:"ids" binding:"required"`
}
type RenameMediaRequest struct {
	ID   uint   `json:"ID"`
	Name string `json:"name"`
}
type ImportMediaRequest struct {
	Name    string `json:"name"`
	ClassID int    `json:"classId"`
	URL     string `json:"url"`
	Tag     string `json:"tag"`
	Key     string `json:"key"`
	Size    int64  `json:"size"`
	Mime    string `json:"mime"`
	MD5     string `json:"md5"`
	UserID  uint   `json:"userId"`
}
type StorageListRequest struct {
	Prefix string `json:"prefix"`
	Cursor string `json:"cursor"`
	Limit  int    `json:"limit"`
}
type CategoryRequest struct {
	ID   uint   `json:"ID"`
	Name string `json:"name"`
	PID  uint   `json:"pid"`
}
type InitUploadRequest struct {
	FileName   string `json:"fileName" binding:"required"`
	FileHash   string `json:"fileHash" binding:"required"`
	FileSize   int64  `json:"fileSize" binding:"required"`
	ChunkSize  int64  `json:"chunkSize" binding:"required"`
	ChunkTotal int    `json:"chunkTotal" binding:"required"`
	Mime       string `json:"mime"`
}
type CompleteUploadRequest struct {
	UploadID uint `json:"uploadId" binding:"required"`
}
