*** Settings ***
Documentation    Smoke tests for Temporal Data Model (Revision-Aware RDF)
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
InMemoryTemporalBackend Protocol Compliance
    [Documentation]    Verify InMemoryTemporalBackend satisfies TemporalBackend protocol
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    protocol-compliance    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-protocol-ok

Revision Chain Creation And Traversal
    [Documentation]    Create 3-version revision chain and verify traversal
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    revision-chain    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-revision-chain-ok

Tier Aware Temporal Queries
    [Documentation]    Verify hot/warm/cold tier queries with temporal filtering
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    tier-queries    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-tier-queries-ok

TemporalService Lifecycle
    [Documentation]    End-to-end service lifecycle: store, revise, query, chain
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    service-lifecycle    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-service-lifecycle-ok

Domain Model Construction
    [Documentation]    Verify all temporal domain models can be constructed
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    model-creation    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-model-creation-ok

Input Validation
    [Documentation]    Verify backends reject invalid inputs
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    validation    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-validation-ok

Retention Config Defaults Match Spec
    [Documentation]    Verify warm=24h, cold=90d defaults per spec lines 28692-28693
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    retention-defaults    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-retention-defaults-ok

Integration Modify Resource Verify Temporal Chain
    [Documentation]    Modify a resource, verify old=historical, new=current, chain intact
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    integration-modify-resource    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    temporal-integration-modify-resource-ok
