*** Settings ***
Library    Process
Library    String

*** Test Cases ***
TUI Permissions Service Initialization
    [Tags]    tdd_issue    tdd_issue_1928
    ${script}=    Catenate    SEPARATOR=\n
    ...    from cleveragents.tui.permissions.service import PermissionRequestService
    ...    service = PermissionRequestService()
    ...    assert service is not None, "PermissionRequestService should be initialized"
    ...    print("permission-service-ok")
    ${result}=    Run Process    ${PYTHON}    -c    ${script}    shell=False
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    permission-service-ok

TUI Permissions Models Validation
    [Tags]    tdd_issue    tdd_issue_1928
    ${script}=    Catenate    SEPARATOR=\n
    ...    from cleveragents.tui.permissions.models import PermissionDecision, FileChangeType, PermissionRequest
    ...    assert PermissionDecision.ALLOW_ONCE == "allow_once", "PermissionDecision.ALLOW_ONCE should equal allow_once"
    ...    assert FileChangeType.MODIFIED == "M", "FileChangeType.MODIFIED should equal M"
    ...    req = PermissionRequest(path="/test/file.py", change_type=FileChangeType.MODIFIED)
    ...    assert req.path == "/test/file.py", "PermissionRequest path should be set"
    ...    print("permission-models-ok")
    ${result}=    Run Process    ${PYTHON}    -c    ${script}    shell=False
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    permission-models-ok

TUI Permissions Screen Initialization
    [Tags]    tdd_issue    tdd_issue_1928
    ${script}=    Catenate    SEPARATOR=\n
    ...    from cleveragents.tui.permissions.screen import PermissionsScreen
    ...    assert callable(PermissionsScreen), "PermissionsScreen should be a callable class"
    ...    print("permission-screen-ok")
    ${result}=    Run Process    ${PYTHON}    -c    ${script}    shell=False
    Should Be Equal As Integers    ${result.rc}    0
    Should Contain    ${result.stdout}    permission-screen-ok
