namespace gitnuro {
    [Throws=WatcherInitError]
    void watch_directory(string path, WatchDirectoryNotifier checker);
};

callback interface WatchDirectoryNotifier {
    boolean should_keep_looping();

    void detected_change(sequence<string> paths);
};

[Error]
interface WatcherInitError {
    Generic(string error);
    Io(string error);
    PathNotFound();
    WatchNotFound();
    InvalidConfig();
    MaxFilesWatch();
};

enum AuthStatus {
    "Success",
    "Denied",
    "Partial",
    "Info",
    "Again",
};


interface Session {
    constructor();
    void setup(string host, string? user, u16? port);
    AuthStatus public_key_auth(string password);
    AuthStatus password_auth(string password);
    void disconnect();
};

interface Channel {
    constructor(Session session);
    void open_session();
    boolean is_open();
    void close();
    void request_exec(string command);
    boolean poll_has_bytes(boolean is_stderr);
    ReadResult read(boolean is_stderr, u64 len);
    void write_byte(i32 byte);
    void write_bytes(bytes data);
};

dictionary ReadResult {
    u64 read_count;
    bytes data;
};