@container-id-integration
Feature: container-instance --container-id integration
  Verifies the full end-to-end flow for attaching a container-instance
  resource to an existing container via the --container-id flag.

  Scenario: CLI add container-instance with --container-id succeeds
    Given a fresh in-memory resource registry for container_id
    And built-in types are bootstrapped for container_id
    When I run resource add container-instance with container-id "abc123def456"
    Then the container_id command should succeed
    And the container_id output should contain "Added resource"

  Scenario: container_id is persisted in resource properties
    Given a fresh in-memory resource registry for container_id
    And built-in types are bootstrapped for container_id
    When I run resource add container-instance with container-id "abc123def456"
    And I show the container_id resource "local/test-ctr"
    Then the container_id show output should contain "abc123def456"

  Scenario: CLI rejects --container-id and --image together
    Given a fresh in-memory resource registry for container_id
    And built-in types are bootstrapped for container_id
    When I run resource add container-instance with both container-id and image
    Then the container_id command should fail

  Scenario: CLI rejects container-instance with neither --image nor --container-id
    Given a fresh in-memory resource registry for container_id
    And built-in types are bootstrapped for container_id
    When I run resource add container-instance with no image or container-id
    Then the container_id command should fail

  Scenario: Handler returns stored container_id without docker subprocess
    Given a container-instance resource with stored container_id "deadbeef1234"
    When I call _find_running_container on the resource
    Then the container_id find result should be "deadbeef1234"
    And no docker subprocess should have been called
