package model import ( "context" "time" ) // JobType represents the type of job type JobType string const ( JobTypeArchiveLink JobType = "archive_link" JobTypeExtractContent JobType = "extract_content" ) // Job represents a background job type Job struct { ID string Type JobType Payload string // JSON encoded payload Status string // pending, processing, completed, failed CreatedAt time.Time } // Queue defines the interface for job queue operations type Queue interface { // Enqueue adds a new job to the queue Enqueue(ctx context.Context, jobType JobType, payload any) error // Dequeue retrieves the next job from the queue Dequeue(ctx context.Context) (*Job, error) // Complete marks a job as completed Complete(ctx context.Context, jobID string) error // Fail marks a job as failed Fail(ctx context.Context, jobID string, errorMsg string) error } // ArchiveLinkPayload is the payload for archive link jobs type ArchiveLinkPayload struct { ArchiveID string `json:"archive_id"` LinkID string `json:"link_id"` ArchiverKeys []string `json:"extractor_keys,omitempty"` // Optional: specific archivers to use (JSON tag kept for backward compatibility) }