rule "conversions"
when true
then
    set_fields({
        string_1: to_string("1"),                           // "1"
        string_2: to_string("2", "default"),                // "2"
        string_3: to_string($message.not_there),            // "" -> not being set in message!
        string_4: to_string($message.not_there, "default"), // "default"
        string_5: to_string(false),                         // "false"
        string_6: to_string(42),                            // "42"
        string_7: to_string(23.42d),                        // "23.42"

        long_1: to_long(1),                            // 1L
        long_2: to_long(2, 1),                         // 2L
        long_3: to_long($message.not_there),           // 0L
        long_4: to_long($message.not_there, 1),        // 1L
        long_5: to_long(23.42d),                       // 23L
        long_6: to_long("23"),                         // 23L
        long_7: to_long("23.42", 1),                   // 1L
        long_min1: to_long("-9223372036854775808", 1), // Long.MIN_VALUE
        long_min2: to_long("-9223372036854775809", 1), // 1L
        long_max1: to_long("9223372036854775807", 1),  // Long.MAX_VALUE
        long_max2: to_long("9223372036854775808", 1),  // 1L

        double_1: to_double(1d),                               // 1d
        double_2: to_double(2d, 1d),                           // 2d
        double_3: to_double($message.not_there),               // 0d
        double_4: to_double($message.not_there, 1d),           // 1d
        double_5: to_double(23),                               // 23d
        double_6: to_double("23"),                             // 23d
        double_7: to_double("23.42"),                          // 23.42d
        double_min1: to_double("4.9E-324"),                    // Double.MIN_VALUE
        double_min2: to_double("4.9E-325", 1d),                // 0d
        double_max1: to_double("1.7976931348623157E308"),      // Double.MAX_VALUE
        double_inf1: to_double("1.7976931348623157E309", 1d),  // Infinity
        double_inf2: to_double("-1.7976931348623157E309", 1d), // -Infinity
        double_inf3: to_double("Infinity", 1d),                // Infinity
        double_inf4: to_double("-Infinity", 1d),               // -Infinity

        bool_1: to_bool("true"),                      // true
        bool_2: to_bool("false", true),               // false
        bool_3: to_bool($message.not_there),          // false
        bool_4: to_bool($message.not_there, true),    // true

        ip_1: to_ip("127.0.0.1"),                 // 127.0.0.1
        ip_2: to_ip("127.0.0.1", "2001:db8::1"),  // 127.0.0.1
        ip_3: to_ip($message.not_there),          // 0.0.0.0
        ip_4: to_ip($message.not_there, "::1"),   // ::1 (v6)

        map_1: to_map({foo:"bar"}),       // Map.of("foo", "bar")
        map_2: to_map("foobar"),          // empty map
        map_3: to_map(23),                // empty map
        map_4: to_map(23.42),             // empty map
        map_5: to_map(true),              // empty map
        map_6: to_map($message.not_there) // empty map
    });
end