*** Settings ***
Documentation    TDD Bug #1038 — validation add --required/--informational flags
...              Integration smoke tests verifying that the ``agents validation add``
...              command accepts ``--required`` and ``--informational`` flags as described
...              in the specification (specification.md line 22339).
...
...              Bug #1038 reported that these flags were missing from the CLI,
...              causing a ``NoSuchOption`` error.  The fix adds them as mutually
...              exclusive boolean options that override the YAML config mode.
...
...              These tests were originally tagged tdd_expected_fail while the bug
...              was unfixed.  Now that the fix is in place, the tag has been removed
...              and the tests run normally as permanent regression guards.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
TDD Validation Add Required Flag Accepted
    [Documentation]    Verify that ``validation add --config <file> --required``
    ...                is accepted by the CLI and sets the validation mode to
    ...                ``required``.
    [Tags]    tdd_issue    tdd_issue_1038
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    check-required    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-validation-required-flag-ok

TDD Validation Add Informational Flag Accepted
    [Documentation]    Verify that ``validation add --config <file> --informational``
    ...                is accepted by the CLI and sets the validation mode to
    ...                ``informational``.
    [Tags]    tdd_issue    tdd_issue_1038
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    check-informational    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-validation-informational-flag-ok

TDD Validation Add Required Flag Overrides YAML Config
    [Documentation]    Verify that ``--required`` overrides a YAML config that
    ...                specifies ``mode: informational``.  Both CLI output and
    ...                the service layer should reflect ``mode: required``.
    [Tags]    tdd_issue    tdd_issue_1038
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    check-required-overrides-config    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-validation-required-overrides-config-ok

TDD Validation Add Informational Flag Overrides YAML Config
    [Documentation]    Verify that ``--informational`` overrides a YAML config
    ...                that specifies ``mode: required``.  Both CLI output and
    ...                the service layer should reflect ``mode: informational``.
    [Tags]    tdd_issue    tdd_issue_1038
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    check-informational-overrides-config    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-validation-informational-overrides-config-ok

TDD Validation Add Both Flags Rejected
    [Documentation]    Verify that passing both ``--required`` and ``--informational``
    ...                simultaneously is rejected with a mutually-exclusive error.
    [Tags]    tdd_issue    tdd_issue_1038
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    check-both-flags-rejected    cwd=${WORKSPACE}    timeout=30s    on_timeout=kill
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    tdd-validation-both-flags-rejected-ok
