namespace SessionZero.Shared.Schema; /// /// Valid types for fields. /// public enum FieldType { Text, MultiText, Number, Boolean, Formula, List } /// /// Represents a list of allowed values for a field with type List. /// public class SzListType { // NOTE: Only one of these lists should be allowed public List? AllowedDatasetTypes { get; set; } public List? AllowedDatasetIds { get; set; } public string? CustomValues { get; set; } } /// /// Represents a formula field. /// public class SzFormulaType { // TODO: Implement a way to parse formulas public string? Formula { get; set; } } /// /// Used to link a dataset in other data or template objects. /// public class DatasetLink { public required Guid DatapackId { get; set; } public required string DatasetId { get; set; } public required string Version { get; set; } } /// /// Used to link a character template in other template objects. /// public class CharacterTemplateLink { public required Guid DatapackId { get; set; } public required string TemplateId { get; set; } public required string Version { get; set; } } /// /// Represents a field value. /// public class FieldValue { public required FieldType Type { get; set; } public required object Value { get; set; } } /// /// Represents a group of fields in a dataset. /// public class DataGroup { public required string Id { get; set; } public required string Name { get; set; } public required Dictionary Fields { get; set; } = new(); } /// /// Represents a dataset entry used in datasets. /// public class DatasetEntry { public required string Id { get; set; } public required string Name { get; set; } public string Description { get; set; } = string.Empty; public string Icon { get; set; } = string.Empty; public Dictionary? TopLevelFields { get; set; } = new(); public List? Groups { get; set; } = new(); } /// /// Represents a section in a template that houses multiple groups. /// public class TemplateSection { public required string Id { get; set; } public required string Name { get; set; } public required List Groups { get; set; } = new(); } /// /// Represents a group of fields in a template. /// public class TemplateGroup { public required string Id { get; set; } public required string Name { get; set; } public required List? Fields { get; set; } = new(); } /// /// Represents a field definition in a template /// (Does not hold actual field values as templates are meant to be filled in upon instance creation). /// public class TemplateFieldDefinition { public required string Id { get; set; } public required string Name { get; set; } public required FieldType Type { get; set; } public object? DefaultValue { get; set; } public DatasetLink? DatasetLink { get; set; } }