# 05 — Contract Management

**Domain:** Contract Management · **BE Owner:** Ashraful (A) · **Assignment tables owned by Munna but consumed here** · **FE:** Bablu

## Features
Contract CRUD · Status transitions · Attachments · Contract Team header (see domain 06 for members/Act-As)

## Workstreams
Database · Backend · API Contract · Validation · Frontend · Tests

### PMS-API-2.3 — Contracts API Contract Lock

**Task ID:** PMS-API-2.3
**Domain:** 05/11
**Feature:** Contract
**Workstream:** API Contract
**Task Title:** Contracts API Contract Lock
**Description:** NEW STRUCTURAL. Include status enum, commercial fields, filters.
**Owner:** Ashraful
**Lane:** A
**Priority:** P0
**Estimate:** 2.00h
**Dependency:** API-2.2
**Dependency Type:** HARD
**Specification Reference:** SRS §10–§11
**Business Rule Reference:** BR-03; client=project client
**API Contract Reference:** Self
**Acceptance Criteria**
- Full CRUD + filter contract published
**Definition of Done:** In 11-api.md
**Git Ownership / File Ownership:** `contracts` → Ashraful
**Git Conflict Risk:** LOW
**Parallelization Notes:** Major FE unlock

_Detail card:_ `docs/projects/PMS_PHASE1_TASK_CARDS.md` → `PMS-API-2.3`

---

### PMS-2.3-BE — Contract CRUD — Backend

**Task ID:** PMS-2.3-BE
**Domain:** 05. Contract
**Feature:** Contract
**Workstream:** Backend
**Task Title:** Contract CRUD — Backend
**Description:** Commercial agreement per project service.
**Owner:** Ashraful
**Lane:** A
**Priority:** P0
**Estimate:** 10.00h
**Dependency:** 2.2-BE HARD; API-2.3 SOFT
**Dependency Type:** HARD/SOFT
**Specification Reference:** SRS §10–§11
**Business Rule Reference:** BR-03; value≥0; client match
**API Contract Reference:** PMS-API-2.3
**Acceptance Criteria**
- Service must belong to project
- Client must match project client
**Definition of Done:** Global BE DoD
**Git Ownership / File Ownership:** `contracts`
**Git Conflict Risk:** MEDIUM — large surface; keep Munna off this table
**Parallelization Notes:** Critical path; unlocks share + assignment

_Detail card:_ `docs/projects/PMS_PHASE1_TASK_CARDS.md` → `PMS-2.3-BE`

---

### PMS-2.3-FE — Contract List/Form — Frontend

**Task ID:** PMS-2.3-FE
**Domain:** 05. Contract
**Feature:** Contract
**Workstream:** Frontend
**Task Title:** Contract List/Form — Frontend
**Description:** Contract UI with project→service cascade.
**Owner:** Bablu
**Lane:** D
**Priority:** P0
**Estimate:** 8.00h
**Dependency:** API-2.3 SOFT; 2.3-BE SOFT; 2.1-FE host preferred
**Dependency Type:** SOFT
**Specification Reference:** Card 2.3-FE
**Business Rule Reference:** Cascade services
**API Contract Reference:** PMS-API-2.3
**Acceptance Criteria**
- Service dropdown only project-attached services
**Definition of Done:** Global FE DoD
**Git Ownership / File Ownership:** FE contracts
**Git Conflict Risk:** LOW
**Parallelization Notes:** Start from API contract

_Detail card:_ `docs/projects/PMS_PHASE1_TASK_CARDS.md` → `PMS-2.3-FE`

---

### PMS-2.4-BE — Contract Status Transitions — Backend

**Task ID:** PMS-2.4-BE
**Domain:** 05. Contract
**Feature:** Contract Status
**Workstream:** Backend
**Task Title:** Contract Status Transitions — Backend
**Description:** Allow-matrix + optional history table.
**Owner:** Ashraful
**Lane:** A
**Priority:** P1
**Estimate:** 5.00h
**Dependency:** 2.3-BE HARD
**Dependency Type:** HARD
**Specification Reference:** SRS §11 statuses
**Business Rule Reference:** Illegal transition → 409/422
**API Contract Reference:** Extend PMS-API-2.3
**Acceptance Criteria**
- Denied transition rejected
- Activate requires minimum fields
**Definition of Done:** Global BE DoD + tests for matrix
**Git Ownership / File Ownership:** `contracts.status`; optional `contract_status_histories`
**Git Conflict Risk:** LOW
**Parallelization Notes:** Parallel with 2.5/2.6 after 2.3

_Detail card:_ `docs/projects/PMS_PHASE1_TASK_CARDS.md` → `PMS-2.4-BE`

---

### PMS-2.6-BE — Contract Attachments — Backend

**Task ID:** PMS-2.6-BE
**Domain:** 05. Contract
**Feature:** Contract Attachments
**Workstream:** Backend
**Task Title:** Contract Attachments — Backend
**Description:** Agreement file upload/list/delete.
**Owner:** Ashraful
**Lane:** A
**Priority:** P2
**Estimate:** 4.00h
**Dependency:** 2.3-BE HARD
**Dependency Type:** HARD
**Specification Reference:** SRS §11 attachments
**Business Rule Reference:** Tenant-scoped files
**API Contract Reference:** Extend PMS-API-2.3
**Acceptance Criteria**
- Authz + company scope
- Type/size limits
**Definition of Done:** Global BE DoD
**Git Ownership / File Ownership:** `contract_attachments`
**Git Conflict Risk:** LOW
**Parallelization Notes:** Parallel with share/status

_Detail card:_ `docs/projects/PMS_PHASE1_TASK_CARDS.md` → `PMS-2.6-BE`

---
