package types import "time" // User represents a user in the system type User struct { ID int64 `json:"id"` Email string `json:"email"` Name string `json:"name"` OAuthProvider string `json:"oauth_provider"` // "google" or "discord" OAuthID string `json:"oauth_id"` CreatedAt time.Time `json:"created_at"` } // JobStatus represents the status of a job type JobStatus string const ( JobStatusPending JobStatus = "pending" JobStatusRunning JobStatus = "running" JobStatusCompleted JobStatus = "completed" JobStatusFailed JobStatus = "failed" JobStatusCancelled JobStatus = "cancelled" ) // Job represents a render job type Job struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` Name string `json:"name"` Status JobStatus `json:"status"` Progress float64 `json:"progress"` // 0.0 to 100.0 FrameStart int `json:"frame_start"` FrameEnd int `json:"frame_end"` OutputFormat string `json:"output_format"` // PNG, JPEG, EXR, etc. AllowParallelRunners bool `json:"allow_parallel_runners"` // Allow multiple runners to work on this job TimeoutSeconds int `json:"timeout_seconds"` // Job-level timeout (24 hours default) CreatedAt time.Time `json:"created_at"` StartedAt *time.Time `json:"started_at,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` ErrorMessage string `json:"error_message,omitempty"` } // RunnerStatus represents the status of a runner type RunnerStatus string const ( RunnerStatusOnline RunnerStatus = "online" RunnerStatusOffline RunnerStatus = "offline" RunnerStatusBusy RunnerStatus = "busy" ) // Runner represents a render runner type Runner struct { ID int64 `json:"id"` Name string `json:"name"` Hostname string `json:"hostname"` IPAddress string `json:"ip_address"` Status RunnerStatus `json:"status"` LastHeartbeat time.Time `json:"last_heartbeat"` Capabilities string `json:"capabilities"` // JSON string of capabilities CreatedAt time.Time `json:"created_at"` } // TaskStatus represents the status of a task type TaskStatus string const ( TaskStatusPending TaskStatus = "pending" TaskStatusRunning TaskStatus = "running" TaskStatusCompleted TaskStatus = "completed" TaskStatusFailed TaskStatus = "failed" ) // Task represents a render task assigned to a runner type Task struct { ID int64 `json:"id"` JobID int64 `json:"job_id"` RunnerID *int64 `json:"runner_id,omitempty"` FrameStart int `json:"frame_start"` FrameEnd int `json:"frame_end"` Status TaskStatus `json:"status"` CurrentStep string `json:"current_step,omitempty"` RetryCount int `json:"retry_count"` MaxRetries int `json:"max_retries"` TimeoutSeconds *int `json:"timeout_seconds,omitempty"` // Task timeout (5 min for frames, 24h for FFmpeg) OutputPath string `json:"output_path,omitempty"` CreatedAt time.Time `json:"created_at"` StartedAt *time.Time `json:"started_at,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` ErrorMessage string `json:"error_message,omitempty"` } // JobFileType represents the type of file type JobFileType string const ( JobFileTypeInput JobFileType = "input" JobFileTypeOutput JobFileType = "output" ) // JobFile represents a file associated with a job type JobFile struct { ID int64 `json:"id"` JobID int64 `json:"job_id"` FileType JobFileType `json:"file_type"` FilePath string `json:"file_path"` FileName string `json:"file_name"` FileSize int64 `json:"file_size"` CreatedAt time.Time `json:"created_at"` } // CreateJobRequest represents a request to create a new job type CreateJobRequest struct { Name string `json:"name"` FrameStart int `json:"frame_start"` FrameEnd int `json:"frame_end"` OutputFormat string `json:"output_format"` AllowParallelRunners *bool `json:"allow_parallel_runners,omitempty"` // Optional, defaults to true } // UpdateJobProgressRequest represents a request to update job progress type UpdateJobProgressRequest struct { Progress float64 `json:"progress"` } // RegisterRunnerRequest represents a request to register a runner type RegisterRunnerRequest struct { Name string `json:"name"` Hostname string `json:"hostname"` IPAddress string `json:"ip_address"` Capabilities string `json:"capabilities"` } // LogLevel represents the level of a log entry type LogLevel string const ( LogLevelInfo LogLevel = "INFO" LogLevelWarn LogLevel = "WARN" LogLevelError LogLevel = "ERROR" LogLevelDebug LogLevel = "DEBUG" ) // TaskLog represents a log entry for a task type TaskLog struct { ID int64 `json:"id"` TaskID int64 `json:"task_id"` RunnerID *int64 `json:"runner_id,omitempty"` LogLevel LogLevel `json:"log_level"` Message string `json:"message"` StepName string `json:"step_name,omitempty"` CreatedAt time.Time `json:"created_at"` } // StepStatus represents the status of a task step type StepStatus string const ( StepStatusPending StepStatus = "pending" StepStatusRunning StepStatus = "running" StepStatusCompleted StepStatus = "completed" StepStatusFailed StepStatus = "failed" StepStatusSkipped StepStatus = "skipped" ) // TaskStep represents an execution step within a task type TaskStep struct { ID int64 `json:"id"` TaskID int64 `json:"task_id"` StepName string `json:"step_name"` Status StepStatus `json:"status"` StartedAt *time.Time `json:"started_at,omitempty"` CompletedAt *time.Time `json:"completed_at,omitempty"` DurationMs *int `json:"duration_ms,omitempty"` ErrorMessage string `json:"error_message,omitempty"` } // TaskAnnotation represents an annotation (warning/error) for a task type TaskAnnotation struct { ID int64 `json:"id"` TaskID int64 `json:"task_id"` StepName string `json:"step_name,omitempty"` Level LogLevel `json:"level"` Message string `json:"message"` Line *int `json:"line,omitempty"` CreatedAt time.Time `json:"created_at"` } // SendTaskLogRequest represents a request to send task logs type SendTaskLogRequest struct { Logs []TaskLogEntry `json:"logs"` } // TaskLogEntry represents a single log entry in a batch request type TaskLogEntry struct { LogLevel LogLevel `json:"log_level"` Message string `json:"message"` StepName string `json:"step_name,omitempty"` }