# Add Validation and Unit Tests

## Summary
Introduced robust data validation using `zod` and unit testing using `vitest` to ensure system stability and correctness of data processing logic.

## Changes

### 1. Data Validation
- **Library**: `zod`
- **File**: `src/schema/kafkaPayload.js`
- **Logic**:
  - Defined strict schema for Kafka payload including required headers (`ts_ms`, `hotel_id`, etc.) and optional arrays (`device_list`, `fault_list`).
  - Implemented automatic type transformation (e.g., `room_id` to string, `cmd_word` normalization).
  - Integrated into `src/processor/index.js` to validate incoming messages before processing.

### 2. Unit Testing
- **Framework**: `vitest`
- **File**: `tests/processor.test.js`
- **Coverage**:
  - Required field validation (throws error on missing fields).
  - `0x36` Status Report processing (device list expansion).
  - `0x36` Fault Report processing (fault list expansion).
  - `0x36` Mixed Report processing.
  - `0x0F` Control Command processing (control list expansion).
  - `0x0F` ACK processing.
  - Fallback logic for empty lists.

### 3. Scripts
- Added `test` script to `package.json`: `vitest run`.

## Verification
- Ran `npm test` and all 7 tests passed successfully.
