# ListProfitCenters

## Overview

ListProfitCenters retrieves a list of profit center records matching optional filter criteria. Callers can filter by companyId and status (DRAFT, ACTIVE, INACTIVE). This query supports profit center browsing, transaction tagging setup, and profitability reporting configuration.

## Business Rules

- Accepts optional filter parameters: `{ companyId, status }`
- Returns a list of profit centers matching all provided filters (AND logic)
- When no filters are provided, returns all profit centers accessible to the caller
- Each returned profit center includes all master data fields and hierarchy node assignment
- Returns an empty list if no profit centers match the given filters
- Results are scoped to the caller's accessible companies

## Process Flow

```mermaid
flowchart TD
    A[Receive input with optional filters] --> B[Build query with provided filters]
    B --> C{companyId provided?}
    C -->|Yes| D[Add companyId filter]
    C -->|No| E[Skip companyId filter]
    D --> F{status provided?}
    E --> F
    F -->|Yes| G[Add status filter]
    F -->|No| H[Skip status filter]
    G --> I[Execute query]
    H --> I
    I --> J[Return list of matching profit centers]
```

## External Dependencies

- None

## Error Scenarios

- **INVALID_STATUS_FILTER**: Provided status value is not valid for this entity type

## Test Cases

- returns all profit centers when no filters are provided
- returns profit centers filtered by companyId
- returns profit centers filtered by status ACTIVE
- returns profit centers filtered by status DRAFT
- returns profit centers matching companyId and status filters simultaneously
- returns an empty list when no profit centers match the given filters
- returns error when status filter is invalid
