*** Settings ***
Documentation    Smoke tests for multi-project subplan support
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER}    ${CURDIR}/helper_multi_project_subplan.py

*** Test Cases ***
Initialize Multi-Project Scopes
    [Documentation]    Initialize project scopes with resource mapping
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    init-scopes    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    multi-project-init-ok

Resolve Alias
    [Documentation]    Resolve a project alias to its ProjectLink
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    resolve-alias    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    multi-project-alias-ok

Validate Mixed Access
    [Documentation]    Mixed access modes without opt-in should produce errors
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate-mixed    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    multi-project-mixed-ok

Record Changeset
    [Documentation]    Record a per-project changeset summary
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    record-changeset    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    multi-project-changeset-ok

Cross-Project Validation
    [Documentation]    Validate cross-project constraints
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validate-cross    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    multi-project-cross-ok

CLI Dict Integration
    [Documentation]    Plan as_cli_dict includes multi-project section
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    cli-dict    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    multi-project-cli-dict-ok
