@container-infra
Feature: Container infrastructure resource types
  Verifies that the 7 container infrastructure resource types
  (container-runtime, container-image, container-mount, container-exec-env,
  container-port, container-volume, container-network) are correctly
  defined, registered, and have proper parent/child relationships.

  # ── YAML schema loading ─────────────────────────────────

  Scenario Outline: Container infra YAML validates for container_infra
    Given the built-in "<type_name>" YAML for container_infra
    When I load the YAML via from_yaml_file for container_infra
    Then the container_infra schema should be valid
    And the container_infra schema name should be "<type_name>"
    And the container_infra schema resource_kind should be "physical"

    Examples:
      | type_name          |
      | container-runtime  |
      | container-image    |
      | container-mount    |
      | container-exec-env |
      | container-port     |
      | container-volume   |
      | container-network  |

  # ── Domain model creation ───────────────────────────────

  Scenario Outline: Container infra YAML loads as domain model for container_infra
    Given the built-in "<type_name>" YAML for container_infra
    When I load the YAML as a ResourceTypeSpec for container_infra
    Then the container_infra domain model should be valid
    And the container_infra domain model name should be "<type_name>"
    And the container_infra domain model resource_kind should be physical

    Examples:
      | type_name          |
      | container-runtime  |
      | container-image    |
      | container-mount    |
      | container-exec-env |
      | container-port     |
      | container-volume   |
      | container-network  |

  # ── Parent/child relationships ──────────────────────────

  Scenario: container-runtime is top-level with children for container_infra
    Given the built-in "container-runtime" YAML for container_infra
    When I load the YAML as a ResourceTypeSpec for container_infra
    Then the container_infra spec should have empty parent_types
    And the container_infra child_types should contain "container-image"
    And the container_infra child_types should contain "container-instance"
    And the container_infra child_types should contain "container-volume"
    And the container_infra child_types should contain "container-network"

  Scenario: container-image parent is runtime for container_infra
    Given the built-in "container-image" YAML for container_infra
    When I load the YAML as a ResourceTypeSpec for container_infra
    Then the container_infra parent_types should contain "container-runtime"
    And the container_infra child_types should contain "container-instance"

  Scenario: container-mount parent is instance for container_infra
    Given the built-in "container-mount" YAML for container_infra
    When I load the YAML as a ResourceTypeSpec for container_infra
    Then the container_infra parent_types should contain "container-instance"
    And the container_infra child_types should contain "fs-directory"
    And the container_infra child_types should contain "fs-file"

  Scenario: container-volume parent is runtime for container_infra
    Given the built-in "container-volume" YAML for container_infra
    When I load the YAML as a ResourceTypeSpec for container_infra
    Then the container_infra parent_types should contain "container-runtime"
    And the container_infra child_types should contain "fs-directory"

  # ── User-addable flags ──────────────────────────────────

  Scenario Outline: Container infra user_addable flags for container_infra
    Given the built-in "<type_name>" YAML for container_infra
    When I load the YAML as a ResourceTypeSpec for container_infra
    Then the container_infra user_addable should be <addable>

    Examples:
      | type_name          | addable |
      | container-runtime  | true    |
      | container-image    | true    |
      | container-mount    | false   |
      | container-exec-env | false   |
      | container-port     | false   |
      | container-volume   | true    |
      | container-network  | false   |

  # ── BUILTIN_NAMES registration ──────────────────────────

  Scenario Outline: Container infra types in BUILTIN_NAMES for container_infra
    Then BUILTIN_NAMES should contain "<type_name>" for container_infra

    Examples:
      | type_name          |
      | container-runtime  |
      | container-image    |
      | container-mount    |
      | container-exec-env |
      | container-port     |
      | container-volume   |
      | container-network  |

  # ── Bootstrap registration ─────────────────────────────

  Scenario: All 7 container infra types in BUILTIN_TYPES for container_infra
    Given the bootstrap builtin type definitions for container_infra
    Then BUILTIN_TYPES should contain "container-runtime" for container_infra
    And BUILTIN_TYPES should contain "container-image" for container_infra
    And BUILTIN_TYPES should contain "container-mount" for container_infra
    And BUILTIN_TYPES should contain "container-exec-env" for container_infra
    And BUILTIN_TYPES should contain "container-port" for container_infra
    And BUILTIN_TYPES should contain "container-volume" for container_infra
    And BUILTIN_TYPES should contain "container-network" for container_infra

  # ── Coverage: verify CONTAINER_INFRA_TYPES module directly ──

  Scenario: CONTAINER_INFRA_TYPES has exactly 7 entries for container_infra
    Then CONTAINER_INFRA_TYPES should have 7 entries for container_infra

  Scenario: Each container infra type has handler reference for container_infra
    Then every CONTAINER_INFRA_TYPES entry should have a handler for container_infra

  Scenario: container-runtime has auto-discovery rules for container_infra
    Then container-runtime in CONTAINER_INFRA_TYPES should have auto_discovery for container_infra
