package tasks import "time" // TaskStatus represents the current status of a task type TaskStatus string const ( TaskStatusRunning TaskStatus = "running" TaskStatusCompleted TaskStatus = "completed" TaskStatusError TaskStatus = "error" ) // TaskType represents the type of background task type TaskType string const ( TaskTypeRecalculate TaskType = "recalculate" TaskTypeStockImport TaskType = "stock_import" TaskTypePricelistCreate TaskType = "pricelist_create" ) // Task represents a background task with progress tracking type Task struct { ID string `json:"id"` Type TaskType `json:"type"` Status TaskStatus `json:"status"` Progress int `json:"progress"` // 0-100 Message string `json:"message"` Result map[string]interface{} `json:"result,omitempty"` Error string `json:"error,omitempty"` CreatedAt time.Time `json:"created_at"` DoneAt *time.Time `json:"done_at,omitempty"` }