# ListUnitsByCategory

## Overview

ListUnitsByCategory retrieves paginated units belonging to a specific UoM category. Used to find related units within a category and to validate category constraints such as ensuring a category has units before deactivation.

## Business Rules

- Returns paginated units with the matching categoryId
- Returns empty result if no units match
- Supports limit, offset, orderBy, and orderDirection parameters
- Indicates whether more results exist via hasNextPage

## Process Flow

```mermaid
flowchart TD
    A[Receive categoryId and pagination params] --> B[SELECT from Unit where categoryId = input with limit+1, offset, order]
    B --> C[Build paginated result with items and hasNextPage]
```

## External Dependencies

- None

## Error Scenarios

- None

## Test Cases

- returns paginated units with default page size
- returns hasNextPage true when more results exist
- returns empty result when no units match
- respects custom limit and offset
- accepts orderBy and orderDirection
