/**
 * Tasks Domain Operations — wire-format contracts for the tasks dispatch domain.
 *
 * Contains only types that appear in the `TasksOps` discriminated union (the
 * authoritative wire-format spec) plus shared primitives (`TaskOp`,
 * `MinimalTask`, `TaskPriority`, `TaskStatus`) used cross-domain.
 *
 * Legacy pre-dispatch aliases (`TasksCreateParams`, `TasksUpdateParams`, etc.)
 * were removed in T1446 (T1435-W2). Use the dispatch-level types
 * (`TasksAddParams`, `TasksUpdateQueryParams`, etc.) that appear in `TasksOps`.
 *
 * Canonical type definitions live in the contracts package at:
 *   packages/contracts/src/task.ts (TaskStatus, TaskPriority, Task, etc.)
 * These operation types are the API contract (wire format).
 * Internal domain types import from the canonical location above.
 *
 * @task T1446 — strip redundant Params/Result aliases (T1435-W2)
 * @task T1703 — Fill Result=unknown stubs with canonical typed shapes
 */
/**
 * JSON Schema draft-07 document describing the accepted input shape for
 * the `tasks.add` mutate operation.
 *
 * Mirrors {@link TasksAddParams} field-for-field. Set
 * `additionalProperties: false` so a typo'd flag fails fast with a typed
 * `E_VAL_ADDITIONALPROPERTIES` error instead of being silently dropped.
 *
 * @task T9917
 */
export const TASKS_ADD_INPUT_SCHEMA = {
    type: 'object',
    required: ['title'],
    additionalProperties: false,
    properties: {
        title: { type: 'string', minLength: 1, maxLength: 500 },
        description: { type: 'string' },
        parent: { type: 'string' },
        depends: { type: 'array', items: { type: 'string' } },
        priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
        labels: { type: 'array', items: { type: 'string' } },
        type: { type: 'string', enum: ['saga', 'epic', 'task', 'subtask'] },
        acceptance: { type: 'array', items: { type: 'string' } },
        phase: { type: 'string' },
        size: { type: 'string', enum: ['small', 'medium', 'large'] },
        notes: { type: 'string' },
        files: { type: 'array', items: { type: 'string' } },
        dryRun: { type: 'boolean' },
        parentSearch: { type: 'string' },
        kind: {
            type: 'string',
            enum: ['work', 'research', 'experiment', 'bug', 'spike', 'release'],
        },
        scope: { type: 'string', enum: ['project', 'feature', 'unit'] },
        severity: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
        forceDuplicate: { type: 'boolean' },
    },
};
/**
 * Schema-first input contract for `tasks.add`.
 *
 * @task T9917
 */
export const tasksAddInputContract = {
    operation: 'tasks.add',
    schema: TASKS_ADD_INPUT_SCHEMA,
    examples: [
        {
            name: 'minimal',
            value: { title: 'Ship E7-MUTATE-DX-SCHEMA-FIRST' },
            description: 'Smallest valid input — title is the only required field.',
        },
        {
            name: 'subtask-with-acceptance',
            value: {
                title: 'Wire validator into add command',
                parent: 'T9903',
                priority: 'high',
                acceptance: ['validator runs before dispatch', 'errors surface in envelope'],
            },
        },
    ],
};
/**
 * JSON Schema draft-07 document describing the accepted input shape for
 * the `tasks.add-batch` mutate operation.
 *
 * Wraps N `tasks.add` specs in a single atomic transaction. `dryRun` is
 * hoisted to the batch level (single rollback unit), so the per-entry
 * schema OMITS `dryRun` deliberately.
 *
 * @task T9917
 */
export const TASKS_ADD_BATCH_INPUT_SCHEMA = {
    type: 'object',
    required: ['tasks'],
    additionalProperties: false,
    properties: {
        tasks: {
            type: 'array',
            minItems: 1,
            items: {
                type: 'object',
                required: ['title'],
                additionalProperties: false,
                properties: {
                    title: { type: 'string', minLength: 1, maxLength: 500 },
                    description: { type: 'string' },
                    parent: { type: 'string' },
                    depends: { type: 'array', items: { type: 'string' } },
                    priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
                    labels: {
                        type: 'array',
                        items: { type: 'string' },
                        'x-fix-hint': 'pass labels as a JSON array, e.g. ["pm-core-v2", "wave.3"]',
                    },
                    type: { type: 'string', enum: ['saga', 'epic', 'task', 'subtask'] },
                    acceptance: {
                        type: 'array',
                        items: { type: 'string' },
                        'x-fix-hint': 'pass acceptance as a JSON array, not a pipe-delimited string',
                    },
                    phase: { type: 'string' },
                    size: { type: 'string', enum: ['small', 'medium', 'large'] },
                    notes: { type: 'string' },
                    files: { type: 'array', items: { type: 'string' } },
                    kind: {
                        type: 'string',
                        enum: ['work', 'research', 'experiment', 'bug', 'spike', 'release'],
                    },
                    scope: { type: 'string', enum: ['project', 'feature', 'unit'] },
                    severity: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
                    forceDuplicate: { type: 'boolean' },
                },
            },
        },
        defaultParent: { type: 'string' },
        dryRun: { type: 'boolean' },
    },
};
/**
 * Schema-first input contract for `tasks.add-batch`.
 *
 * @task T9917
 */
export const tasksAddBatchInputContract = {
    operation: 'tasks.add-batch',
    schema: TASKS_ADD_BATCH_INPUT_SCHEMA,
    examples: [
        {
            name: 'two-tasks',
            value: {
                tasks: [
                    {
                        title: 'first task',
                        labels: ['pm-core-v2', 'wave.3'],
                        acceptance: ['first acceptance criterion'],
                    },
                    {
                        title: 'second task',
                        labels: ['batch'],
                        acceptance: ['second acceptance criterion'],
                    },
                ],
            },
            description: 'Atomic insert of two tasks under no shared parent.',
        },
        {
            name: 'with-default-parent',
            value: {
                defaultParent: 'T9903',
                tasks: [{ title: 'a' }, { title: 'b', parent: 'T9914' }],
            },
            description: 'defaultParent applies to entries without an explicit parent.',
        },
    ],
};
/**
 * JSON Schema draft-07 document describing the accepted input shape for
 * the `tasks.update` mutate operation.
 *
 * Mirrors {@link TasksUpdateQueryParams}. `taskId` is REQUIRED. All other
 * fields are optional — `tasks.update` is a partial update; only the
 * fields supplied are mutated.
 *
 * @task T9917
 */
export const TASKS_UPDATE_INPUT_SCHEMA = {
    type: 'object',
    required: ['taskId'],
    additionalProperties: false,
    properties: {
        taskId: { type: 'string', minLength: 1 },
        title: { type: 'string', minLength: 1, maxLength: 500 },
        description: { type: 'string' },
        status: {
            type: 'string',
            enum: ['pending', 'active', 'blocked', 'done', 'cancelled'],
        },
        priority: { type: 'string', enum: ['low', 'medium', 'high', 'critical'] },
        notes: { type: 'string' },
        labels: { type: 'array', items: { type: 'string' } },
        addLabels: { type: 'array', items: { type: 'string' } },
        removeLabels: { type: 'array', items: { type: 'string' } },
        depends: { type: 'array', items: { type: 'string' } },
        addDepends: { type: 'array', items: { type: 'string' } },
        removeDepends: { type: 'array', items: { type: 'string' } },
        acceptance: { type: 'array', items: { type: 'string' } },
        parent: { type: ['string', 'null'] },
        type: { type: 'string', enum: ['saga', 'epic', 'task', 'subtask'] },
        size: { type: 'string', enum: ['small', 'medium', 'large'] },
        files: { type: 'array', items: { type: 'string' } },
        addFiles: { type: 'array', items: { type: 'string' } },
        removeFiles: { type: 'array', items: { type: 'string' } },
        pipelineStage: { type: 'string' },
        kind: {
            type: 'string',
            enum: ['work', 'research', 'experiment', 'bug', 'spike', 'release'],
        },
        scope: { type: 'string', enum: ['project', 'feature', 'unit'] },
        severity: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
        reason: { type: 'string' },
        dependsWaiver: { type: 'string' },
        clearBlockedBy: { type: 'boolean' },
        relates: {
            type: 'array',
            items: {
                type: 'object',
                required: ['taskId', 'type'],
                additionalProperties: false,
                properties: {
                    taskId: { type: 'string', minLength: 1 },
                    type: { type: 'string', minLength: 1 },
                    reason: { type: 'string' },
                },
            },
        },
        addRelates: {
            type: 'array',
            items: {
                type: 'object',
                required: ['taskId', 'type'],
                additionalProperties: false,
                properties: {
                    taskId: { type: 'string', minLength: 1 },
                    type: { type: 'string', minLength: 1 },
                    reason: { type: 'string' },
                },
            },
        },
        removeRelates: { type: 'array', items: { type: 'string' } },
    },
};
/**
 * Schema-first input contract for `tasks.update`.
 *
 * @task T9917
 */
export const tasksUpdateInputContract = {
    operation: 'tasks.update',
    schema: TASKS_UPDATE_INPUT_SCHEMA,
    examples: [
        {
            name: 'set-status',
            value: { taskId: 'T9917', status: 'active' },
            description: 'Transition status to active.',
        },
        {
            name: 'add-labels-incrementally',
            value: {
                taskId: 'T9917',
                addLabels: ['saga.t9855', 'epic.t9903'],
            },
        },
    ],
};
//# sourceMappingURL=tasks.js.map