using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChamChat
{
      public static class Clients
    {
          public static List<Client> GetAll()
          {
              List<Client> result = new List<Client>();

              Client client00018 = new HTS7057_Client(18, Models.ClientType.HTS7057);
              client00018.Address = 1;
              result.Add(client00018);

              Client client00847 = new TSx_Client(847, Models.ClientType.TSE11A);
              client00847.Address = 1;
              result.Add(client00847);

              Client client00947 = new TSx_Client(947, Models.ClientType.TSE11A);
              client00947.Address = 2;
              result.Add(client00947);

              Client client00987 = new TSx_Client(987, Models.ClientType.TSE11A);
              client00987.Address = 3;
              result.Add(client00987);

              Client client01728 = new TSx_Client(1728, Models.ClientType.TSD100);
              client01728.Address = 4;
              result.Add(client01728);

              Client client01880 = new TSx_Client(1880, Models.ClientType.TSE11A);
              client01880.Address = 5;
              result.Add(client01880);

              Client client00781 = new LHL113_Client(781, Models.ClientType.LHL113);
              client00781.Address = 6;
              result.Add(client00781);

              Client client00782 = new LHL113_Client(782, Models.ClientType.LHL113);
              client00782.Address = 7;
              result.Add(client00782);

              Client client00986 = new PLxKPH_Client(986, Models.ClientType.PL3KPH);
              client00986.Address = 8;
              result.Add(client00986);

              Client client01056 = new PLxKPH_Client(1056, Models.ClientType.PL2KPH);
              client01056.Address = 9;
              result.Add(client01056);

              Client client01120 = new PLxKPH_Client(1120, Models.ClientType.PL3KPH);
              client01120.Address = 10;
              result.Add(client01120);


              //Client client00995 = new Client(995, null);
              //client00995.Address = 11;
              //result.Add(client00995);

              //Client client01238 = new Client(1238, null);
              //client01238.Address = 12;
              //result.Add(client01238);

              //Client client02183 = new Client(2183, null);
              //client02183.Address = 13;
              //result.Add(client02183);

              Client client02222 = new TSx_Client(2222, Models.ClientType.TSD100S);
              client02222.Address = 14;
              result.Add(client02222);


              Client client00038 = new Watlow988U_Client(38, Models.ClientType.Despatch_Watlow988U);
              client00038.Address = 1;
              result.Add(client00038);



              return OrderByMIDS(result);
          }


        private static List<Client> OrderByMIDS(List<Client> list)
        {
            List<Client> result = new List<Client>();


            while (list.Count > 0)
            {
                int k = 0;
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i].MIDS < list[k].MIDS)
                        k = i;
                }
                result.Add(list[k]);
                list.RemoveAt(k);
          }
            return result;
        }

    }
}
