Feature: Google Gemini chat provider coverage
  As a maintainer integrating real provider adapters
  I want unit-level Behave scenarios for the Google Gemini chat provider
  So that the implementation stays documented and regression tested

  @unit @providers @google
  Scenario: Google provider instantiates ChatGoogleGenerativeAI with provided credentials
    Given I have sample provider domain inputs
    When I create a Google chat provider with API key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    And I request plan generation from the Google provider
    Then the Google provider should construct ChatGoogleGenerativeAI with api key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    And the Google provider metadata should report name "google" and model "gemini-2.0-flash"

  @unit @providers @google
  Scenario: Google provider stubbed response reports metadata
    Given I have sample provider domain inputs
    And I create a Google chat provider with API key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    When I request plan generation from the Google provider
    Then the Google provider response should contain no generated changes
    And the Google provider response should report the requested model without errors

  @unit @providers @google
  Scenario: Google provider rejects missing API key
    Given I have sample provider domain inputs
    When I attempt to create a Google chat provider without an API key
    Then the Google provider creation should fail with error "Google API key is required"

  @unit @providers @google
  Scenario: Google provider forwards optional kwargs
    Given I have sample provider domain inputs
    And I set the Google provider extra kwargs "temperature=0.35,max_output_tokens=2048"
    When I create a Google chat provider with API key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    And I request plan generation from the Google provider
    Then the Google provider should construct ChatGoogleGenerativeAI with api key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    And the Google provider should include kwargs "temperature=0.35,max_output_tokens=2048" in the ChatGoogleGenerativeAI call

  @unit @providers @google
  Scenario: Google provider reports runtime errors
    Given I have sample provider domain inputs
    And I create a Google chat provider with API key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    And the plan generation graph raises RuntimeError "deadline reached"
    When I request plan generation from the Google provider
    Then the Google provider response should report error "deadline reached"
    And the Google provider response should contain no generated changes

  @unit @providers @google
  Scenario: Google provider streaming yields workflow events
    Given I have sample provider domain inputs
    And the plan generation graph returns a generated change for "app/stream.py"
    And the plan generation graph emits streaming nodes "load_context,analyze_requirements,generate_plan,validate"
    And I create a Google chat provider with API key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    When I stream plan generation from the Google provider
    Then the Google provider streaming events should include nodes "load_context,analyze_requirements,generate_plan,validate"
    And the Google provider streaming result should finish with a response containing 1 generated change

  @unit @providers @google
  Scenario: Google provider surfaces plan generation errors
    Given I have sample provider domain inputs
    And the plan generation graph raises ValueError "graph exploded"
    And I create a Google chat provider with API key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    When I request plan generation from the Google provider
    Then the Google provider response should report error "graph exploded"
    And the Google provider response should contain no generated changes

  @unit @providers @google
  Scenario: Google provider supports streaming responses
    Given I have sample provider domain inputs
    And I create a Google chat provider with API key "AIzaSy-unit-test" and model "gemini-2.0-flash"
    Then the Google provider should support streaming responses
