*** Settings ***
Documentation     Verify legacy plan commands emit deprecation warnings.
Library           Process
Library           OperatingSystem
Variables         ${CURDIR}/helper_plan_lifecycle_persistence.py

*** Keywords ***
Run Python Script
    [Arguments]    ${script}    @{extra_args}
    ${result}=    Run Process    ${PYTHON}    @{extra_args}    ${CURDIR}/legacy_plan_removal_helper.py    ${script}
    ...    env:PYTHONPATH\=src:.    timeout=120s    on_timeout=kill
    RETURN    ${result}

*** Test Cases ***
Legacy Plan Tell Emits Deprecation Warning
    [Documentation]    Verify that importing and using legacy PlanService triggers a deprecation warning.
    ${result}=    Run Python Script    plan_service    -W    all
    Should Contain    ${result.stderr}    DeprecationWarning

Legacy PlanRepository Emits Deprecation Warning
    [Documentation]    Verify PlanRepository emits DeprecationWarning on instantiation.
    ${result}=    Run Python Script    plan_repository    -W    all
    Should Contain    ${result.stderr}    DeprecationWarning

Legacy ChangeRepository Emits Deprecation Warning
    [Documentation]    Verify ChangeRepository emits DeprecationWarning on instantiation.
    ${result}=    Run Python Script    change_repository    -W    all
    Should Contain    ${result.stderr}    DeprecationWarning

V3 Lifecycle Service Does Not Emit Deprecation
    [Documentation]    Verify PlanLifecycleService does NOT emit DeprecationWarning.
    ${result}=    Run Python Script    lifecycle_service    -W    error::DeprecationWarning
    Should Be Equal As Integers    ${result.rc}    0
