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

pub const Window = opaque {};

pub const PropertiesID = u32;

pub const DialogFileFilter = extern struct {
    name: [*c]const u8,
    pattern: [*c]const u8,
};

pub const DialogFileCallback = c.SDL_DialogFileCallback;

pub inline fn showOpenFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8, allow_many: bool) void {
    return c.SDL_ShowOpenFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location, allow_many);
}

pub inline fn showSaveFileDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, filters: *const DialogFileFilter, nfilters: c_int, default_location: [*c]const u8) void {
    return c.SDL_ShowSaveFileDialog(callback, userdata, window, @ptrCast(filters), nfilters, default_location);
}

pub inline fn showOpenFolderDialog(callback: DialogFileCallback, userdata: ?*anyopaque, window: ?*Window, default_location: [*c]const u8, allow_many: bool) void {
    return c.SDL_ShowOpenFolderDialog(callback, userdata, window, default_location, allow_many);
}

pub const FileDialogType = enum(c_int) {
    filedialogOpenfile,
    filedialogSavefile,
    filedialogOpenfolder,
};

pub inline fn showFileDialogWithProperties(_type: FileDialogType, callback: DialogFileCallback, userdata: ?*anyopaque, props: PropertiesID) void {
    return c.SDL_ShowFileDialogWithProperties(@intFromEnum(_type), callback, userdata, props);
}
