package models

import (
	"time"

	"gorm.io/datatypes"
)

type Program struct {
	ID        string         `json:"id" db:"id" example:"ef74c59a-c707-4162-a52b-455906c81ec1"  gorm:"column:id;size:255;primary_key;"`
	Course    string         `json:"course" db:"course" example:"코스 이름" gorm:"column:course;size:40;index;"`
	Subject   string         `json:"subject" db:"subject" example:"프로그램 제목" gorm:"column:subject;size:255;index;"`
	Content   string         `json:"content" db:"content" example:"코스 설명" gorm:"column:content;size:512;"`
	Tag       datatypes.JSON `json:"tag" db:"tag" gorm:"column:tag;"`
	Tags      string         `json:"-" db:"tags" gorm:"column:tags;index;"`
	Status    string         `json:"status" example:"on" gorm:"column:status;size:10;index;"`
	PublishAt time.Time      `json:"publish_at" example:"2023-11-10T00:00:00+09:00" gorm:"column:publish_at;index;"`
	UpdatedAt time.Time      `json:"-" gorm:"column:updated_at;index;"`
	CreatedAt time.Time      `json:"-" gorm:"column:created_at;index;"`
}

type ProgramRequest struct {
	Course    string         `json:"course" example:"코스 이름"`
	Subject   string         `json:"subject" example:"프로그램 제목"`
	Content   string         `json:"content" example:"코스 설명"`
	Tag       datatypes.JSON `json:"tag"`
	Status    string         `json:"status" example:"on"`
	PublishAt string         `json:"publish_at" example:"2023-11-10T00:00:00+09:00"`
}

type ProgramResponse struct {
	ID        string   `json:"id" example:"ef74c59a-c707-4162-a52b-455906c81ec1"`
	Course    string   `json:"course" example:"코스 이름"`
	Subject   string   `json:"subject" example:"프로그램 제목"`
	Content   string   `json:"content" example:"코스 설명"`
	Tag       []string `json:"tag" example:"tag1,tag2"`
	Status    string   `json:"status" example:"on"`
	PublishAt string   `json:"publish_at" example:"2023-11-10T00:00:00+09:00"`
}

type ProgramListResponse struct {
	Data      []Program `json:"data"`
	Total     int64     `json:"total" example:"999"`
	Page      int       `json:"page" example:"1"`
	TotalPage int64     `json:"totalPage" example:"99"`
	PageSize  int       `json:"pageSize" example:"10"`
}
