Feature: Plan Merge Strategy Configuration
  As a team lead
  I want to configure how plan conflicts are resolved
  So that my team can choose the appropriate conflict resolution behavior

  Background:
    Given a merge strategy service is initialized

  Scenario: Prefer-parent strategy auto-resolves conflicts in favor of parent
    Given the merge strategy is set to "prefer-parent"
    When a conflict occurs with parent value "parent_data" and subplan value "subplan_data"
    Then the conflict should be auto-resolved with value "parent_data"
    And the strategy should support auto-resolution

  Scenario: Prefer-subplan strategy auto-resolves conflicts in favor of subplan
    Given the merge strategy is set to "prefer-subplan"
    When a conflict occurs with parent value "parent_data" and subplan value "subplan_data"
    Then the conflict should be auto-resolved with value "subplan_data"
    And the strategy should support auto-resolution

  Scenario: Manual strategy surfaces conflicts for user resolution
    Given the merge strategy is set to "manual"
    When a conflict occurs with parent value "parent_data" and subplan value "subplan_data"
    Then the conflict should require manual resolution
    And the strategy should not support auto-resolution

  Scenario: Multiple conflicts are resolved according to strategy
    Given the merge strategy is set to "prefer-parent"
    When multiple conflicts occur:
      | path | parent_value | subplan_value |
      | field1 | value1 | value2 |
      | field2 | value3 | value4 |
    Then all conflicts should be resolved with parent values

  Scenario: Manual strategy raises error when attempting auto-resolution
    Given the merge strategy is set to "manual"
    When a conflict occurs with parent value "parent_data" and subplan value "subplan_data"
    And attempting to auto-resolve conflicts
    Then an error should be raised indicating manual resolution is required

  Scenario: Merge strategy can be created from string value
    When a merge strategy is created from string "prefer-parent"
    Then the strategy should be "prefer-parent"
    And the strategy string representation should be "prefer-parent"

  Scenario: Invalid merge strategy string raises error
    When attempting to create a merge strategy from invalid string "invalid-strategy"
    Then an error should be raised with message containing "Invalid merge strategy"

  Scenario: No conflicts means no resolution needed
    Given the merge strategy is set to "prefer-parent"
    When there are no conflicts
    Then the resolution should return an empty result
    And no conflicts should be detected
