﻿using DNK.TourMLPriceSelector;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DNK.PriceListImport.MetroClubLoader
{
    public abstract class RowMetroClub
    {
        protected string name;
        public string Name { get { return name; } }
        protected Dictionary<int, string> columnValues;
        public Dictionary<int, string> ColumnValues { get { return columnValues; } }
        public void AddColumnValue(int index, string value)
        {
            if (columnValues == null)
                columnValues = new Dictionary<int, string>();
            if (!columnValues.ContainsKey(index))
                columnValues.Add(index, value);
        }
        public int IndexLastColumnValue
        {
            get
            {
                return columnValues == null ? -1 : columnValues.Max(p => p.Key);
            }
        }
        public string GetColumnValue(int row)
        {
            if (columnValues != null && columnValues.ContainsKey(row))
                return columnValues[row];
            return string.Empty;
        }

        public bool ChangePrice(int index, string newValue)
        {
            if (columnValues != null && columnValues.ContainsKey(index))
            {
                columnValues[index] = newValue;
                return true;
            }
            return false;
        }

    }
}
