//
//  GSInfoValueLocalized.h
//  GlyphsCore
//
//  Created by Georg Seifert on 05.04.19.
//  Copyright © 2019 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSBase.h>
#import <GlyphsCore/GSInfoProperty.h>
#import <GlyphsCore/GSInstance.h>
@class GSCustomParameter;
@class GSFont;
@class GSInfoValue;

NS_ASSUME_NONNULL_BEGIN

@interface GSInfoValueLocalized : GSInfoProperty {
#pragma GSAutoCodeStart ivars

	NSMutableArray<GSInfoValue *> *_values;

#pragma GSAutoCodeEnd ivars
}

- (instancetype)initWithKey:(NSString *)key value:(NSString *)value languageTag:(nullable NSString *)languageTag;

- (nullable GSInfoValue *)infoValueForLanguageTag:(NSString *)languageTag;

- (nullable NSString *)defaultValue;

- (BOOL)hasLocalizations;

#pragma mark - start auto interface
#pragma GSAutoCodeStart methods

#pragma mark Values

/// The values.
@property (nonatomic, strong) NSMutableArray<GSInfoValue *> *values;

/** The number of values */
- (NSUInteger)countOfValues;

- (GSInfoValue *)objectInValuesAtIndex:(NSUInteger)idx;

- (NSUInteger)indexOfObjectInValues:(GSInfoValue *)value;

- (void)addValue:(GSInfoValue *)value;

- (void)insertObject:(GSInfoValue *)value inValuesAtIndex:(NSUInteger)idx;

- (void)removeObjectFromValues:(GSInfoValue *)value;

/** Removes the value at idx

 @param idx The index
 */
- (void)removeObjectFromValuesAtIndex:(NSUInteger)idx;

#pragma GSAutoCodeEnd methods

+ (NSMutableArray<GSInfoValue *> *)fontInfoValuesFromDicts:(NSArray<NSDictionary *> *)list format:(GSFormatVersion)formatVersion;

#ifndef LIBCORE
+ (nullable NSArray<GSCustomParameter *> *)legacyCustomParametersFromProperties:(NSArray <GSInfoProperty *> *)properties object:(GSFont *)object error:(NSError **)error;

+ (void)loadLegacyCustomParameters:(NSArray<GSCustomParameter *> *)parameters parent:(GSFont *)parent;
#endif

+ (void)_setProperty:(NSString *)name value:(nullable id)value languageTag:(nullable NSString *)languageTag container:(__kindof GSFont *)container notify:(BOOL)notify;

@end

NS_ASSUME_NONNULL_END
