using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using System.Collections.Generic; using System.Linq; namespace Needlework.Net.ViewModels.Pages.Endpoints; public class PropertyClassViewModel : ObservableObject { public PropertyClassViewModel(string id, IDictionary properties, IList enumValue) { List propertyFields = []; List propertyEnums = []; foreach ((var propertyName, var propertySchema) in properties) { var type = OperationViewModel.GetSchemaType(propertySchema); var field = new PropertyFieldViewModel(propertyName, type); propertyFields.Add(field); } if (enumValue != null && enumValue.Any()) { var propertyEnum = new PropertyEnumViewModel(enumValue); propertyEnums.Add(propertyEnum); } PropertyFields = propertyFields; PropertyEnums = propertyEnums; Id = id; } public string Id { get; } public List PropertyFields { get; } = []; public List PropertyEnums { get; } = []; }