# Операционная модель данных

## 1. `feed_program`

Назначение: возрастные и партионные программы кормления.

Таблица: `poultry_feed_program`.

Ключевые поля:

- `id` (PK)
- `tenant_id`, `site_id`, `house_id`, `batch_id?`
- `subtype`, `age_phase_id`
- `feed_type`
- `target_gram_per_bird`
- `feeding_windows` (JSON schedule)
- `distribution_mode`
- `status`
- `version_id`, `state`, `change_note`, `rollback_of`
- `updated_at`

DTO: `FeedProgramDTO`.

## 2. `water_profile`

Назначение: профиль водопотребления и пороги аномалий.

Таблица: `poultry_water_profile`.

Ключевые поля:

- `id` (PK)
- `tenant_id`, `site_id`, `house_id`, `batch_id?`
- `subtype`, `age_phase_id`
- `target_ml_per_bird`
- `water_line_pressure_kpa`
- `flow_deviation_warn_pct`, `flow_deviation_alarm_pct`
- `status`
- `version_id`, `state`, `change_note`, `rollback_of`
- `updated_at`

DTO: `WaterProfileDTO`.

## 3. `production_kpi`

Назначение: дневной срез производственных KPI по партии.

Таблица: `poultry_production_kpi`.

Ключевые поля:

- `id` (PK)
- `tenant_id`, `site_id`, `house_id`, `batch_id`
- `metric_date`
- `subtype`
- `bird_count_alive`, `mortality_percent`
- `feed_intake_gram_per_bird`, `water_intake_ml_per_bird`
- `average_weight_gram`, `daily_gain_gram`, `fcr` (broiler)
- `egg_production_percent`, `egg_mass_gram` (layer)
- `out_of_norm_flags` (JSON)
- `updated_at`

DTO: `ProductionKPIDTO`.

## 4. Связи

- `feed_program.age_phase_id -> age_phase.id`
- `water_profile.age_phase_id -> age_phase.id`
- `production_kpi.batch_id -> batch.id`
- `production_kpi.house_id -> house.id`
