# ReopenPeriod

## Permission Scope

periodManagement

## Overview

reopenPeriod transitions an accounting period from CLOSED back to OPEN status, allowing journal entry postings to resume. This supports scenarios where late-arriving transactions or corrections need to be recorded after initial close.

## Business Rules

- Period must exist and be in CLOSED status
- Only CLOSED periods can be reopened; PERMANENTLY_CLOSED periods cannot be reopened
- After transition, the period resumes accepting journal entry postings

## Process Flow

```mermaid
flowchart TD
    A[Receive reopenPeriod request] --> B{Period exists?}
    B -->|No| C[Return error: period not found]
    B -->|Yes| D{Period status is CLOSED?}
    D -->|No| E[Return error: invalid status transition]
    D -->|Yes| F[Transition period to OPEN]
    F --> H[Return updated period]
```

## External Dependencies

- None

## Error Scenarios

- **ACCOUNTING_PERIOD_NOT_FOUND**: Referenced accounting period does not exist
- **INVALID_STATUS_TRANSITION**: Requested status transition is not allowed from the current status

## Test Cases

- returns error when accounting period does not exist
- returns error when period is in NEVER_OPENED status
- returns error when period is in OPEN status
- returns error when period is in PERMANENTLY_CLOSED status
- transitions CLOSED period back to OPEN
