package local:hubro-sdk;

interface mobile-host {
    get-health-connect-records: func(record-type: s32, start-time: s32, end-time: s32) -> string;
    get-health-connect-number-of-records: func(record-type: s32, start-time: s32, end-time: s32) -> s32;
    print-line: func(line: string);
    get-platform: func() -> string;
    get-usage-data: func(start-time: s32, end-time: s32) -> string;
    get-usage-data-number-of-records: func(start-time: s32, end-time: s32) -> s32;
    upload-server-key: func(key: list<u8>) -> s32;
    host-load-model: func(path: string) -> s32;
    host-run-inference: func(model-id: s32, input: list<f32>, shape: list<s32>, output-len: s32) -> list<f32>;
}

interface mobile-sdk-api {
    enum platform {
        ios,
        android,
        js,
        unknown,
    }

    fetch-records-count: func(record-type: s32, start-time: s32, end-time: s32) -> s32;
    get-usage-data-count: func(start-time: s32, end-time: s32) -> s32;
    debug-print-line: func(output: string);
    get-current-platform: func() -> platform;
    load-model: func(path: string) -> s32;
    run-inference: func(model-id: s32, input: list<f32>, shape: list<s32>, output-len: s32) -> list<f32>;
    upload-key: func(server-key: list<u8>) -> s32;
    get-current-time-nanos: func() -> u64;
    quantize-float-to-u16: func(weight: f32, x-min: f32, x-max: f32) -> u16;
}

world mobile-sdk {
    import mobile-host;
    export mobile-sdk-api;
}