const std = @import("std");

pub const JSON = struct {
    full_text: []const u8,
    short_text: ?[]const u8 = null,
    color: ?[]const u8 = null,
    background: ?[]const u8 = null,
    border: ?[]const u8 = null,
    border_top: ?u16 = null,
    border_right: ?u16 = null,
    border_bottom: ?u16 = null,
    border_left: ?u16 = null,
    min_width: ?u16 = null,
    @"align": ?[]const u8 = null,
    name: ?[]const u8 = null,
    instance: ?[]const u8 = null,
    urgent: ?bool = null,
    separator: ?bool = null,
    separator_block_width: ?u16 = null,
    markup: ?[]const u8 = null,
};

const Self = @This();

getBlockFn: *const fn (*Self, std.mem.Allocator) anyerror!Block,

pub fn getBlock(self: *Self, allocator: std.mem.Allocator) anyerror!Block {
    return self.getBlockFn(self, allocator);
}

pub const Block = struct {
    full_text: []const u8,
    short_text: ?[]const u8 = null,
    /// from 0.0 to 1.0, affects foreground color
    /// from 1.0 to 2.0, affects background and foreground colors
    severity: f32 = 0.0,
};
