using PCUT.Entities;
using PCUT.ViewModels;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PCUT.Models.Categories
{
    public class CategoryModel : Category
    {
        public string DisplayId { get; set; }
        public ObservableCollection<MetadataTypeModel> CategoryMetadata { get; }

        public CategoryModel()
        {
            CategoryMetadata = new ObservableCollection<MetadataTypeModel>
            {
                new MetadataTypeModel(this, 1, MetadataViewModel.TypeHeader),
                new MetadataTypeModel(this, 2, MetadataViewModel.BrandHeader),
                new MetadataTypeModel(this, 3, MetadataViewModel.SerieHeader),
                new MetadataTypeModel(this, 4, MetadataViewModel.ModelHeader),
                new MetadataTypeModel(this, 5, MetadataViewModel.SubTypeHeader),
                new MetadataTypeModel(this, 6, MetadataViewModel.YearHeader)
            };
        }
    }

    public class MetadataTypeModel : NotificationBase
    {
        public CategoryModel Category { get; }
        public int DisplayId { get; set; }
        public string Name { get; }
        public bool IsLoaded { get; set; }

        private bool _isExpanded;
        public bool IsExpanded
        {
            get { return _isExpanded; }
            set { SetProperty(ref _isExpanded, value); }
        }

        public ObservableCollection<CategoryMetadataModel> Metadata { get; } = new ObservableCollection<CategoryMetadataModel>();

        public MetadataTypeModel(CategoryModel category, int displayId, string name)
        {
            Category = category;
            DisplayId = displayId;
            Name = name;
            IsLoaded = false;
        }
    }

    public class CategoryMetadataModel : CategoryMetadata
    {
        public MetadataTypeModel MetadataType { get; set; }
        public int DisplayId { get; set; }
    }
}
