# Requirements — {{projectName}}

> Version: {{version}} | Phase: {{currentPhase}}

---

## Functional Requirements

{{#each features}}
### {{@index}}. {{this.name}}

{{this.description}}

#### User Stories
{{#each this.userStories}}
**As a** {{this.role}}
**I want** {{this.want}}
**So that** {{this.why}}

{{/each}}

#### Acceptance Criteria
{{#each this.acceptanceCriteria}}
**Given** {{this.given}}
**When** {{this.when}}
**Then** {{this.then}}

{{/each}}

#### Dependencies
{{#if this.dependencies}}
- Depends on: {{this.dependencies}}
{{/if}}

{{#if this.apiContracts}}
**API Contracts:** `{{this.apiContracts}}`
{{/if}}

{{/each}}

---

## Non-Functional Requirements

### Performance
{{#each nfrs.performance}}
- {{this}}

{{/each}}

### Security
{{#each nfrs.security}}
- {{this}}

{{/each}}

### Reliability
{{#each nfrs.reliability}}
- {{this}}

{{/each}}

### Maintainability
{{#each nfrs.maintainability}}
- {{this}}

{{/each}}

### Scalability
{{#each nfrs.scalability}}
- {{this}}

{{/each}}

---

## Data Requirements

{{#if dataRequirements}}
### Entities
{{#each dataRequirements.entities}}
#### {{this.name}}
{{#each this.fields}}
- **{{this.name}}** ({{this.type}}){{#if this.required}} *required*{{/if}}: {{this.description}}
{{/each}}

{{/each}}
{{/if}}

---

## API Requirements

{{#if apiRequirements}}
{{#each apiRequirements}}
### {{this.name}}
- **Endpoint:** `{{this.method}} {{this.path}}`
- **Description:** {{this.description}}
- **Authentication:** {{this.authentication}}
- **Rate Limit:** {{this.rateLimit}}

{{#if this.request}}
**Request:**
```{{this.request.format}}
{{this.request.schema}}
```
{{/if}}

{{#if this.response}}
**Response:**
```{{this.response.format}}
{{this.response.schema}}
```
{{/if}}

{{#if this.errors}}
**Error Responses:**
{{#each this.errors}}
- `{{this.code}}` — {{this.description}}
{{/each}}
{{/if}}

{{/each}}
{{/if}}

---

## UI/UX Requirements

{{#if uiRequirements}}
### Design Principles
{{#each uiRequirements.principles}}
- {{this}}
{{/each}}

### Screen Requirements
{{#each uiRequirements.screens}}
#### {{this.name}}
{{this.description}}

**States:**
{{#each this.states}}
- {{this.name}}: {{this.description}}
{{/each}}

**Interactions:**
{{#each this.interactions}}
- {{this}}
{{/each}}

{{/each}}
{{/if}}

---

## Integration Requirements

{{#if integrations}}
{{#each integrations}}
### {{this.name}}
- **Type:** {{this.type}}
- **Purpose:** {{this.purpose}}
- **Contract:** `{{this.contractPath}}`
- **SLA:** {{this.sla}}

{{/each}}
{{/if}}

---

## Testing Requirements

{{#if testing}}
### Test Coverage
- Minimum: {{testing.coverage}}%
- Critical paths: 100%

### Test Types Required
{{#each.testing.types}}
- {{this}}
{{/each}}

### Performance Tests
{{#if testing.performance}}
{{testing.performance}}
{{/if}}

### Security Tests
{{#if testing.security}}
{{testing.security}}
{{/if}}
{{/if}}

---

## Compliance & Legal

{{#if compliance}}
{{#each compliance}}
- **{{this.area}}:** {{this.requirement}}
{{/each}}
{{/if}}

---

## Assumptions & Dependencies

### Assumptions
{{#each assumptions}}
- {{this}}
{{/each}}

### External Dependencies
{{#each dependencies}}
- **{{this.name}}** (v{{this.version}}) — {{this.purpose}}
{{/each}}

---

> **Token Budget:** ~4000 tokens max
> **Last Updated:** {{timestamp}}
