package notification

import (
	"context"
	"time"
)

// TaskEventSink receives every task event so non-Mattermost consumers (e.g. the
// proto-socket broadcaster) can fan out task status changes.
type TaskEventSink interface {
	HandleTaskEvent(context.Context, TaskEvent) error
}

type TaskNotification struct {
	TaskID  string
	Title   string
	Status  string
	Message string
}

type TaskEventType string

const (
	TaskEventRunning   TaskEventType = "task.running"
	TaskEventCompleted TaskEventType = "task.completed"
	TaskEventFailed    TaskEventType = "task.failed"
	TaskEventCanceled  TaskEventType = "task.canceled"
)

type TaskEvent struct {
	Type       TaskEventType
	TaskID     string
	Title      string
	Status     string
	Message    string
	Attempt    int
	Reason     string
	OccurredAt time.Time
}
