package com.correx.core.tasks

import com.correx.core.events.types.ProjectId
import kotlinx.datetime.Instant

/**
 * Projected state of a single task, rebuilt by folding its events through [TaskReducer].
 * Mirrors the shape of `SessionState`: defaults make the empty/pre-creation state valid.
 */
data class TaskState(
    val status: TaskStatus = TaskStatus.TODO,
    val key: String? = null,
    val projectId: ProjectId? = null,
    val title: String? = null,
    val goal: String? = null,
    val acceptanceCriteria: List<String> = emptyList(),
    val affectedPaths: List<String> = emptyList(),
    val links: List<TaskLink> = emptyList(),
    val claimant: String? = null,
    val notes: List<TaskNote> = emptyList(),
    val createdAt: Instant? = null,
    val updatedAt: Instant? = null,
    val invalidTransitions: Int = 0,
    /** Soft-deleted tombstone — repository reads hide these; the events remain in the log. */
    val deleted: Boolean = false,
)
