package workflow

import "encoding/json"

type TaskStatus string

const (
	StatusPending   TaskStatus = "pending"
	StatusQueued    TaskStatus = "queued"
	StatusRunning   TaskStatus = "running"
	StatusCompleted TaskStatus = "completed"
	StatusFailed    TaskStatus = "failed"
	StatusCanceled  TaskStatus = "canceled"
)

type CreateTaskInput struct {
	Title    string            `json:"title"`
	Source   string            `json:"source"`
	Payload  json.RawMessage   `json:"payload"`
	Metadata json.RawMessage   `json:"metadata,omitempty"`
	External *ExternalRefInput `json:"external,omitempty"`
}

type ExternalRefInput struct {
	Provider string          `json:"provider"`
	ID       string          `json:"id"`
	URL      string          `json:"url"`
	Metadata json.RawMessage `json:"metadata"`
}

const (
	MetadataKeyAgentRunState = "agent_run_state"
	MetadataKeyAgentPhase    = "agent_phase"
	MetadataKeyWaitType      = "wait_type"
	MetadataKeyStatusReason  = "status_reason"
	MetadataKeyLastHeartbeat = "last_heartbeat_at"
	MetadataKeyPlanRef       = "plan_ref"
	MetadataKeyAttempt       = "attempt"
)
