*** Settings ***
Documentation    Smoke tests for Session domain model
...              Validates session creation, message ordering,
...              serialization output, and export key order.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Create Session With Valid Data
    [Documentation]    Create a session and verify default fields
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    session-create-ok

Append Messages With Auto Sequencing
    [Documentation]    Append multiple messages and verify ordering
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    append-messages    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    session-append-ok

Export Session Dict Contains Required Keys
    [Documentation]    Export session and verify all required keys are present
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    export    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    session-export-ok

CLI Dict Contains Required Keys
    [Documentation]    Get CLI dict and verify required keys
    [Tags]    tdd_issue    tdd_issue_4315    tdd_expected_fail

    ${result}=    Run Process    ${PYTHON}    ${HELPER}    cli-dict    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    session-cli-dict-ok

Export Dict Key Order Matches Specification
    [Documentation]    Verify export dict keys are in expected serialization order
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    export-key-order    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    session-export-order-ok
