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

namespace Dfs.WayneChina.IMisPlus.Models
{
    /// <summary>
    /// Forecourt config
    /// </summary>
    public class ForecourtConfig
    {
        #region Constructor

        public ForecourtConfig()
        {
            Dispensers = new List<Dispenser>();
            Pumps = new List<Pump>();
            Tanks = new List<Tank>();
            Terminals = new List<Terminal>();
            Fuels = new List<Fuel>();
        }

        #endregion

        public bool IsConfigValid()
        {
            if (string.IsNullOrEmpty(CurrentVersion))
                return false;

            if (Terminals.Count == 0 || Pumps.Count == 0 || Pumps.Count > 0 && Pumps.Any(p => p.Nozzles.Count == 0))
                return false;

            return true;
        }

        public string CurrentVersion { get; set; }

        public IList<Dispenser> Dispensers { get; set; }

        public IList<Pump> Pumps { get; set; }

        public IList<Tank> Tanks { get; set; }

        public IList<Terminal> Terminals { get; set; }

        public IList<Fuel> Fuels { get; set; }
    }
}