using NetworkResurrector.Api.Application.Helpers;
using NetworkResurrector.Api.Application.Queries;
using System;
using System.Linq;

namespace NetworkResurrector.Api.Application.Extensions
{
    internal static class ModelExtensions
    {
        public static void Fake(this GetMachines.Model[] models)
        {
            var count = models.Length;
            var ips = DataFaker.GenerateIPv4AddressesInSubnet(count).ToArray();

            foreach (var model in models)
            {
                model.MachineName = DataFaker.GenerateName();
                model.FullMachineName = $"{model.MachineName}.DEMO.LAB";
                model.IPv4Address = ips[Array.IndexOf(models, model)];
                model.MACAddress = Randomizer.Randomize(model.MACAddress);
                model.Description = $"{model.FullMachineName} description";
            }
        }
    }
}
