// Mirror of backend Pydantic response schemas

export interface Plant {
  id: string;
  name: string;
  species: string;
  variety_type: "scion" | "rootstock" | "both";
  drought_tolerance: number;
  salinity_tolerance: number;
  heat_tolerance: number;
  cold_tolerance: number;
  disease_resistance: Record<string, number>;
  optimal_ph_min: number;
  optimal_ph_max: number;
  nutrient_uptake_efficiency: Record<string, number>;
  root_depth_category: "shallow" | "medium" | "deep";
  growth_cycle_days: number;
  yield_potential_kg_per_plant: number;
  description?: string;
  image_url?: string;
  created_at: string;
  updated_at: string;
}

export interface SoilProfile {
  id: string;
  name: string;
  soil_type: "sandy" | "loam" | "clay" | "silt" | "peat" | "chalky";
  ph_level: number;
  organic_matter_percent: number;
  drainage_rate: "poor" | "moderate" | "good" | "excessive";
  water_retention: "low" | "medium" | "high";
  native_nitrogen: number;
  native_phosphorus: number;
  native_potassium: number;
  salinity_level: number;
  temperature_range_min: number;
  temperature_range_max: number;
  description?: string;
  climate_zone: string;
  created_at: string;
  updated_at: string;
}

export interface GraftCombination {
  id: string;
  rootstock_id: string;
  scion_id: string;
  rootstock: Plant;
  scion: Plant;
  compatibility_score: number;
  vigor_boost: number;
  yield_modifier: number;
  stress_tolerance_override: Record<string, number>;
  notes?: string;
  source_reference?: string;
  created_at: string;
  updated_at: string;
}

export interface ScenarioResult {
  id: string;
  scenario_id: string;
  predicted_yield?: number;
  survival_probability?: number;
  risk_factors: string[];
  recommended_adjustments: Record<string, unknown>;
  growth_timeline: Array<{
    week: number;
    stage: string;
    expected_height_cm: number;
    notes: string;
  }>;
  confidence_score?: number;
  ai_analysis?: string;
  created_at: string;
}

export interface Scenario {
  id: string;
  name: string;
  graft_combination_id?: string;
  plant_id?: string;
  soil_profile_id: string;
  applied_nitrogen: number;
  applied_phosphorus: number;
  applied_potassium: number;
  irrigation_method: "drip" | "sprinkler" | "flood" | "rainfed";
  irrigation_frequency_days: number;
  season: "spring" | "summer" | "autumn" | "winter";
  duration_days: number;
  created_at: string;
  updated_at: string;
  soil_profile: SoilProfile;
  graft_combination?: GraftCombination;
  plant?: Plant;
  results?: ScenarioResult;
}

export interface ScenarioSummary {
  id: string;
  name: string;
  season: string;
  duration_days: number;
  created_at: string;
  predicted_yield?: number;
  survival_probability?: number;
  confidence_score?: number;
}
