*** Settings ***
Documentation    Smoke tests for Skill protocol types
Resource         ${CURDIR}/common.resource
Suite Setup      Setup Test Environment
Suite Teardown   Cleanup Test Environment

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

*** Test Cases ***
Create Skill Metadata
    [Documentation]    Create SkillMetadata from a Skill domain model
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create-metadata    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-protocol-metadata-ok

Create Skill Error
    [Documentation]    Create a SkillError with required fields
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create-error    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-protocol-error-ok

Create Skill Result
    [Documentation]    Create a successful SkillResult
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create-result    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-protocol-result-ok

Create Skill Definition
    [Documentation]    Create a SkillDefinition with resolved tools
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    create-definition    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-protocol-definition-ok

Map Tool Error
    [Documentation]    Map an exception to a SkillError via error mapping
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    map-error    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-protocol-map-ok

Verify Error Types Count
    [Documentation]    SkillErrorType should have exactly 7 members
    ${result}=    Run Process    ${PYTHON}    ${HELPER}    error-types    cwd=${WORKSPACE}
    Log    ${result.stdout}
    Log    ${result.stderr}
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    skill-protocol-error-types-ok
