function serializeTaskData(data) {
    if (!data) {
        return undefined;
    }
    return {
        task: data.task,
        worktree: data.worktree,
        branch: data.branch,
        base_branch: data.base_branch,
        workflow: data.workflow,
        issue: data.issue,
        start_step: data.start_step,
        retry_note: data.retry_note,
        auto_pr: data.auto_pr,
        draft_pr: data.draft_pr,
        managed_pr: data.managed_pr,
        should_publish_branch_to_origin: data.should_publish_branch_to_origin,
        exceeded_max_steps: data.exceeded_max_steps,
        exceeded_current_iteration: data.exceeded_current_iteration,
    };
}
function serializeTaskFailure(failure) {
    if (!failure) {
        return undefined;
    }
    return {
        step: failure.step,
        error: failure.error,
        last_message: failure.last_message,
    };
}
export function serializeTaskListItemForJson(task) {
    return {
        kind: task.kind,
        name: task.name,
        createdAt: task.createdAt,
        filePath: task.filePath,
        content: task.content,
        summary: task.summary,
        branch: task.branch,
        worktreePath: task.worktreePath,
        prUrl: task.prUrl,
        data: serializeTaskData(task.data),
        failure: serializeTaskFailure(task.failure),
        startedAt: task.startedAt,
        completedAt: task.completedAt,
        ownerPid: task.ownerPid,
        issueNumber: task.issueNumber,
        exceededMaxSteps: task.exceededMaxSteps,
        exceededCurrentIteration: task.exceededCurrentIteration,
    };
}
//# sourceMappingURL=listSerializer.js.map