import time
from simulation.sim_base import BaseSimulation, run_sim

class AISettingsSimulation(BaseSimulation):
 def run(self) -> None:
  print("\n--- Running AI Settings Simulation (Gemini Only) ---")
  # 1. Verify initial model
  provider = self.client.get_value("current_provider")
  model = self.client.get_value("current_model")
  print(f"[Sim] Initial Provider: {provider}, Model: {model}")
  assert provider == "gemini_cli", f"Expected gemini_cli, got {provider}"
  # 2. Switch to another Gemini model
  other_gemini = "gemini-2.0-flash"
  print(f"[Sim] Switching to {other_gemini}...")
  self.client.set_value("current_model", other_gemini)
  time.sleep(2)
  # Verify
  new_model = self.client.get_value("current_model")
  print(f"[Sim] Updated Model: {new_model}")
  assert new_model == other_gemini, f"Expected {other_gemini}, got {new_model}"
  # 3. Switch back to flash-lite
  target_model = "gemini-2.5-flash-lite"
  print(f"[Sim] Switching back to {target_model}...")
  self.client.set_value("current_model", target_model)
  time.sleep(2)
  final_model = self.client.get_value("current_model")
  print(f"[Sim] Final Model: {final_model}")
  assert final_model == target_model, f"Expected {target_model}, got {final_model}"

if __name__ == "__main__":
 run_sim(AISettingsSimulation)
