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" ) // JobType represents the type of a job type JobType string const ( JobTypeRender JobType = "render" // Render job - needs frame range, format, etc. ) // Job represents a render job type Job struct { ID int64 `json:"id"` UserID int64 `json:"user_id"` JobType JobType `json:"job_type"` // "render" Name string `json:"name"` Status JobStatus `json:"status"` Progress float64 `json:"progress"` // 0.0 to 100.0 FrameStart *int `json:"frame_start,omitempty"` // Only for render jobs FrameEnd *int `json:"frame_end,omitempty"` // Only for render jobs OutputFormat *string `json:"output_format,omitempty"` // Only for render jobs - PNG, JPEG, EXR, etc. BlendMetadata *BlendMetadata `json:"blend_metadata,omitempty"` // Extracted metadata from blend file 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 Priority int `json:"priority"` // Higher number = higher priority (default: 100) 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" ) // TaskType represents the type of a task type TaskType string const ( TaskTypeRender TaskType = "render" TaskTypeEncode TaskType = "encode" ) // 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"` Frame int `json:"frame"` TaskType TaskType `json:"task_type"` 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 { JobType JobType `json:"job_type"` // "render" Name string `json:"name"` FrameStart *int `json:"frame_start,omitempty"` // Required for render jobs FrameEnd *int `json:"frame_end,omitempty"` // Required for render jobs OutputFormat *string `json:"output_format,omitempty"` // Required for render jobs RenderSettings *RenderSettings `json:"render_settings,omitempty"` // Optional: Override blend file render settings UploadSessionID *string `json:"upload_session_id,omitempty"` // Optional: Session ID from file upload UnhideObjects *bool `json:"unhide_objects,omitempty"` // Optional: Enable unhide tweaks for objects/collections EnableExecution *bool `json:"enable_execution,omitempty"` // Optional: Enable auto-execution in Blender (adds --enable-autoexec flag, defaults to false) BlenderVersion *string `json:"blender_version,omitempty"` // Optional: Override Blender version (e.g., "4.2" or "4.2.3") PreserveHDR *bool `json:"preserve_hdr,omitempty"` // Optional: Preserve HDR range for EXR encoding (uses HLG with bt709 primaries) PreserveAlpha *bool `json:"preserve_alpha,omitempty"` // Optional: Preserve alpha channel for EXR encoding (requires AV1 or VP9 codec) } // 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,omitempty"` // Optional, extracted from request by manager Capabilities string `json:"capabilities"` Priority *int `json:"priority,omitempty"` // Optional, defaults to 100 if not provided } // 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"` } // BlendMetadata represents extracted metadata from a blend file type BlendMetadata struct { FrameStart int `json:"frame_start"` FrameEnd int `json:"frame_end"` HasNegativeFrames bool `json:"has_negative_frames"` // True if blend file has negative frame numbers (not supported) RenderSettings RenderSettings `json:"render_settings"` SceneInfo SceneInfo `json:"scene_info"` MissingFilesInfo *MissingFilesInfo `json:"missing_files_info,omitempty"` UnhideObjects *bool `json:"unhide_objects,omitempty"` // Enable unhide tweaks for objects/collections EnableExecution *bool `json:"enable_execution,omitempty"` // Enable auto-execution in Blender (adds --enable-autoexec flag, defaults to false) BlenderVersion string `json:"blender_version,omitempty"` // Detected or overridden Blender version (e.g., "4.2" or "4.2.3") PreserveHDR *bool `json:"preserve_hdr,omitempty"` // Preserve HDR range for EXR encoding (uses HLG with bt709 primaries) PreserveAlpha *bool `json:"preserve_alpha,omitempty"` // Preserve alpha channel for EXR encoding (requires AV1 or VP9 codec) } // MissingFilesInfo represents information about missing files/addons type MissingFilesInfo struct { Checked bool `json:"checked"` HasMissing bool `json:"has_missing"` MissingFiles []string `json:"missing_files,omitempty"` MissingAddons []string `json:"missing_addons,omitempty"` Error string `json:"error,omitempty"` } // RenderSettings represents render settings from a blend file type RenderSettings struct { ResolutionX int `json:"resolution_x"` ResolutionY int `json:"resolution_y"` FrameRate float64 `json:"frame_rate"` Samples int `json:"samples,omitempty"` // Deprecated, use EngineSettings OutputFormat string `json:"output_format"` Engine string `json:"engine"` EngineSettings map[string]interface{} `json:"engine_settings,omitempty"` } // SceneInfo represents scene information from a blend file type SceneInfo struct { CameraCount int `json:"camera_count"` ObjectCount int `json:"object_count"` MaterialCount int `json:"material_count"` }