package theater:simple;

interface filesystem {
    read-file: func(path: string) -> result<list<u8>, string>;
    write-file: func(path: string, content: string) -> result<_, string>;
    list-files: func(path: string) -> result<list<string>, string>;
    delete-file: func(path: string) -> result<_, string>;
    create-dir: func(path: string) -> result<_, string>;
    delete-dir: func(path: string) -> result<_, string>;
    path-exists: func(path: string) -> result<bool, string>;

    record command-success {   
        stdout: string,
        stderr: string,
        exit-code: s32,
    }

    record command-error {
        message: string,
    }

    variant command-result {
        success(command-success),
        error(command-error),
    }
    
    execute-command: func(dir: string, command: string, args: list<string>) -> result<command-result, string>;
    execute-nix-command: func(dir: string, command: string) -> result<command-result, string>;
}
