using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace DataObjects
{

    public class MyDataSource
    {

        protected MyData[] _data = new[]
        {
            new  MyData("1", "title1",_strings1, 1, 1.0),
            new  MyData("2", "title2", _strings2, 2, 2.0),
        };
        
        private static SubClass[] _strings1 = new[]
        {
            new SubClass("Michal", "Tal"),
            new SubClass("Carmel", "Arbel")
        };

        private static SubClass[] _strings2 = new[]
        {
            new SubClass("222", "333"),
            new SubClass("sfsdf", "dfsdvf")
        };

        public IList<MyData> GetData => _data;

        public IList<SubClass> GetSubData(string iddd)
        {
            return _data.FirstOrDefault(d => d.Id == iddd)?.Description;
        }


    }

    public class MyData
    {
        public MyData(string id, string title, SubClass[] description, int propertyInt, double propertyDouble)
        {
            Id = id;
            Title = title;
            Description = description;
            PropertyInt = propertyInt;
            PropertyDouble = propertyDouble;
        }

        public string Id { get; }

        public string Title { get; }

        public IList<SubClass> Description { get; }

        public int PropertyInt { get; }

        public double PropertyDouble { get; }

    }

    public class SubClass
    {
        public string A { get; }
        public string B { get; }

        public SubClass(string a, string b)
        {
            A = a;
            B = b;
        }
    }


}
