package model

import (
	"time"
)

type DurableTask struct {
	ID        int       `orm:"column(id)" json:"id"`
	CreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
	UpdatedAt time.Time `orm:"auto_now;type(datetime)" json:"updatedAt"`

	TaskID      string `orm:"size(48)"` // 用于标识任务
	Description string `orm:"size(255)"`
	CreatedBy   string `orm:"size(48)"`
	FinishedAt  time.Time
	Status      int

	TotalItem    int
	FinishedItem int
}

type DurableTaskItem struct {
	ID        int       `orm:"column(id)" json:"id"`
	CreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"`
	UpdatedAt time.Time `orm:"auto_now;type(datetime)" json:"updatedAt"`

	TaskID     string `orm:"size(48)"` // 用于标识任务
	TaskIndex  int
	ObjHint    string `orm:"size(48)"`
	FuncName   string `orm:"size(48)"`
	Params     string `orm:"size(2000)"` // 序列化后的参数
	FinishedAt time.Time
	Status     int
}
