from copy import deepcopy


def base_review_workflow_job(*, donor_id: str = "usaid") -> dict:
    return {
        "status": "done",
        "state": {
            "donor_id": donor_id,
            "critic_notes": {
                "fatal_flaws": [
                    {
                        "finding_id": "finding-1",
                        "status": "open",
                        "severity": "high",
                        "section": "toc",
                        "message": "Theory of Change repeats boilerplate narrative across multiple sections.",
                    }
                ]
            },
            "critic_fatal_flaws": [
                {
                    "finding_id": "finding-1",
                    "status": "open",
                    "severity": "high",
                    "section": "toc",
                    "message": "Theory of Change repeats boilerplate narrative across multiple sections.",
                }
            ],
        },
        "review_comments": [
            {
                "comment_id": "comment-1",
                "status": "open",
                "section": "toc",
                "linked_finding_id": "finding-1",
                "ts": "2026-03-01T10:00:00+00:00",
                "updated_ts": "2026-03-01T10:30:00+00:00",
                "due_at": "2026-03-01T11:00:00+00:00",
            },
            {
                "comment_id": "comment-2",
                "status": "acknowledged",
                "section": "toc",
                "linked_finding_id": "finding-1",
                "ts": "2026-03-03T09:00:00+00:00",
                "acknowledged_at": "2026-03-03T09:15:00+00:00",
            },
            {
                "comment_id": "comment-3",
                "status": "resolved",
                "section": "logframe",
                "ts": "2026-03-03T10:00:00+00:00",
                "resolved_at": "2026-03-03T10:30:00+00:00",
            },
        ],
        "job_events": [
            {
                "event_id": "evt-1",
                "ts": "2026-03-01T10:30:00+00:00",
                "type": "review_comment_added",
                "comment_id": "comment-1",
                "section": "toc",
            },
            {
                "event_id": "evt-2",
                "ts": "2026-03-03T09:15:00+00:00",
                "type": "review_comment_status_changed",
                "comment_id": "comment-2",
                "section": "toc",
                "status": "acknowledged",
            },
            {
                "event_id": "evt-3",
                "ts": "2026-03-03T10:30:00+00:00",
                "type": "review_comment_status_changed",
                "comment_id": "comment-3",
                "section": "logframe",
                "status": "resolved",
            },
        ],
    }


def clone_review_workflow_job(*, donor_id: str = "usaid") -> dict:
    return deepcopy(base_review_workflow_job(donor_id=donor_id))
