// Written by retoor@molodetz.nl

// This code snippet demonstrates a simple usage of an autocomplete structure. It creates a new autocomplete object, adds several strings to
// it, attempts to find a string using the autocomplete functionality, and then cleans up by freeing the allocated memory.

// Summary of used imports: "rautocomplete.h" - assumed to provide the necessary functions and data structures for the autocomplete
// functionality.

// MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#include "rautocomplete.h"

int main() {
    rautocomplete_t *ac = rautocomplete_new();
    rstring_list_add(ac, "first");
    rstring_list_add(ac, "test2");
    rstring_list_add(ac, "test3");
    rstring_list_add(ac, "test4");
    rstring_list_add(ac, "test5");
    rstring_list_add(ac, "test6");
    rstring_list_add(ac, "test7");
    rstring_list_add(ac, "test8");
    rstring_list_add(ac, "test9");
    rstring_list_add(ac, "test10");
    rstring_list_add(ac, "test11");
    rstring_list_add(ac, "test12");
    rstring_list_add(ac, "test13");
    rstring_list_add(ac, "test14");
    rstring_list_add(ac, "test15");
    rstring_list_add(ac, "test16");
    rstring_list_add(ac, "test17");
    rstring_list_add(ac, "test18");
    rstring_list_add(ac, "test19");
    rstring_list_add(ac, "test20");

    printf("%s", r4_escape("test"));

    char *str = rautocomplete_find(ac, "firsta");
    if (str) {
        printf("%s\n", str);
    }

    rautocomplete_free(ac);
    return 0;
}