*** Settings ***
Documentation    Smoke tests for correction model and service
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

*** Variables ***
${HELPER_SCRIPT}    robot/helper_correction_model.py

*** Test Cases ***
Create Revert Correction
    [Documentation]    Create a correction request in revert mode
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    create_revert    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-create-revert-ok

Create Append Correction
    [Documentation]    Create a correction request in append mode
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    create_append    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-create-append-ok

Dry Run Impact Analysis
    [Documentation]    Create a dry-run correction and analyze impact
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    dry_run    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-dry-run-ok

Cancel Correction
    [Documentation]    Cancel a pending correction
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    cancel    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-cancel-ok

Execute Correction
    [Documentation]    Execute a correction and verify result
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    execute    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-execute-ok

List Corrections
    [Documentation]    List corrections filtered by plan
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    list_by_plan    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-list-ok

Validate Empty Guidance
    [Documentation]    Verify empty guidance is accepted
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    validate_guidance    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-validate-guidance-ok

Correction Model Enums
    [Documentation]    Verify correction mode and status enum values
    ${result}=    Run Process    ${PYTHON}    ${HELPER_SCRIPT}    enums    cwd=${WORKSPACE}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    correction-enums-ok
