*** Settings ***
Documentation    Integration tests for A2A Agent Card discovery
...
...              Tests verify that the Agent Card model, factory, conformance
...              validation, discovery endpoint, skill enumeration, and
...              version negotiation all work end-to-end.
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Build Agent Card From Facade
    [Documentation]    build_agent_card produces a valid card from a facade
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    build-card    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    build-card-ok

Agent Card A2A Conformance Validation
    [Documentation]    Agent Card passes A2A specification conformance checks
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    conformance    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    conformance-ok

Agent Card Discovery Endpoint
    [Documentation]    /.well-known/agent.json returns full Agent Card with skills
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    endpoint    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    endpoint-ok

Agent Card JSON Serialization
    [Documentation]    Agent Card round-trips through JSON serialization
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    serialization    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    serialization-ok

Agent Card Skill Enumeration
    [Documentation]    Skills are correctly enumerated from facade operations
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    skill-enumeration    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-enumeration-ok

Agent Card Version Negotiation Info
    [Documentation]    Agent Card includes correct version negotiation information
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    version-info    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    version-info-ok
