//
//  GSAdvancedPreferences.h
//  Glyphs 4
//
//  Created by Florian Pircher on 10.03.25.
//  Copyright © 2025 schriftgestaltung.de. All rights reserved.
//

NS_ASSUME_NONNULL_BEGIN

@interface GSAdvancedPreferences : NSViewController <NSTableViewDataSource, NSTableViewDelegate>

@property (class, nonatomic, readonly) GSAdvancedPreferences *sharedAdvancedPreferences;

/// Appends new entries in the given order to the end of a category, or creates a new category, if it does not exist yet.
///
/// Each entry is a dictionary with required `key` and `type` elements.
/// The key is the user defaults key.
/// The type is one of `string`, `bool`, `int` (any king of integer), `float` (any kind of floating point number, including double), or `color`.
///
/// A `title` key can provide a user-friendly display title for the entry.
/// A `details` key can provide a user-friendly display description of the entry that is shown in a tool tip.
/// A `options` key can provide additional infos about the entry.
///
/// Schema:
///
/// ```
/// {
///     title: NSString
///     key: NSString (required)
///     type: NSString (required)
///     details: NSString
///     options: NSDictionary {
///         minValue: NSNumber (for type `int` and `float`)
///         maxValue: NSNumber (for type `int` and `float`)
///         enum: NSArray<NSString *> (for type `string`)
///         enum: NSArray<NSNumber *> (for type `int`)
///         enumTitles: NSDictionary<NSString *, NSString *> (for type `string`)
///         enumTitles: NSDictionary<NSNumber *, NSString *> (for type `int`)
///     }
/// }
/// ```
///
/// - The `minValue` and `maxValue` options limit the range of possible values.
/// - The `enum` option provides an ordered set of possible raw values.
/// - The `enumTitles` option maps enum raw values to display titles. Raw values without a mapped title are displayed directly.
- (void)registerEntries:(NSArray<NSDictionary<NSString *, id> *> *)entries forCategory:(NSString *)category;

@end

NS_ASSUME_NONNULL_END
