const std = @import("std");
pub const c = @import("c.zig").c;

pub const PropertiesID = u32;

pub const PropertyType = enum(c_int) {
    propertyTypeInvalid,
    propertyTypePointer,
    propertyTypeString,
    propertyTypeNumber,
    propertyTypeFloat,
    propertyTypeBoolean,
};

pub inline fn getGlobalProperties() PropertiesID {
    return c.SDL_GetGlobalProperties();
}

pub inline fn createProperties() PropertiesID {
    return c.SDL_CreateProperties();
}

pub inline fn copyProperties(src: PropertiesID, dst: PropertiesID) bool {
    return c.SDL_CopyProperties(src, dst);
}

pub inline fn lockProperties(props: PropertiesID) bool {
    return c.SDL_LockProperties(props);
}

pub inline fn unlockProperties(props: PropertiesID) void {
    return c.SDL_UnlockProperties(props);
}

pub const CleanupPropertyCallback = c.SDL_CleanupPropertyCallback;

pub inline fn setPointerPropertyWithCleanup(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque, cleanup: CleanupPropertyCallback, userdata: ?*anyopaque) bool {
    return c.SDL_SetPointerPropertyWithCleanup(props, name, value, cleanup, userdata);
}

pub inline fn setPointerProperty(props: PropertiesID, name: [*c]const u8, value: ?*anyopaque) bool {
    return c.SDL_SetPointerProperty(props, name, value);
}

pub inline fn setStringProperty(props: PropertiesID, name: [*c]const u8, value: [*c]const u8) bool {
    return c.SDL_SetStringProperty(props, name, value);
}

pub inline fn setNumberProperty(props: PropertiesID, name: [*c]const u8, value: i64) bool {
    return c.SDL_SetNumberProperty(props, name, value);
}

pub inline fn setFloatProperty(props: PropertiesID, name: [*c]const u8, value: f32) bool {
    return c.SDL_SetFloatProperty(props, name, value);
}

pub inline fn setBooleanProperty(props: PropertiesID, name: [*c]const u8, value: bool) bool {
    return c.SDL_SetBooleanProperty(props, name, value);
}

pub inline fn hasProperty(props: PropertiesID, name: [*c]const u8) bool {
    return c.SDL_HasProperty(props, name);
}

pub inline fn getPropertyType(props: PropertiesID, name: [*c]const u8) PropertyType {
    return @intFromEnum(c.SDL_GetPropertyType(props, name));
}

pub inline fn getPointerProperty(props: PropertiesID, name: [*c]const u8, default_value: ?*anyopaque) ?*anyopaque {
    return c.SDL_GetPointerProperty(props, name, default_value);
}

pub inline fn getStringProperty(props: PropertiesID, name: [*c]const u8, default_value: [*c]const u8) [*c]const u8 {
    return c.SDL_GetStringProperty(props, name, default_value);
}

pub inline fn getNumberProperty(props: PropertiesID, name: [*c]const u8, default_value: i64) i64 {
    return c.SDL_GetNumberProperty(props, name, default_value);
}

pub inline fn getFloatProperty(props: PropertiesID, name: [*c]const u8, default_value: f32) f32 {
    return c.SDL_GetFloatProperty(props, name, default_value);
}

pub inline fn getBooleanProperty(props: PropertiesID, name: [*c]const u8, default_value: bool) bool {
    return c.SDL_GetBooleanProperty(props, name, default_value);
}

pub inline fn clearProperty(props: PropertiesID, name: [*c]const u8) bool {
    return c.SDL_ClearProperty(props, name);
}

pub const EnumeratePropertiesCallback = c.SDL_EnumeratePropertiesCallback;

pub inline fn enumerateProperties(props: PropertiesID, callback: EnumeratePropertiesCallback, userdata: ?*anyopaque) bool {
    return c.SDL_EnumerateProperties(props, callback, userdata);
}

pub inline fn destroyProperties(props: PropertiesID) void {
    return c.SDL_DestroyProperties(props);
}
