using System.Collections.Generic;
using Baza_Reklam.Classes.Model;

namespace Baza_Reklam.Classes.Repositories
{
    public class StateRepository
    {
        public static List<State> FindAll()
        {
            return StaticStates.GetStates();
        }

        public static int Count()
        {
            return StaticStates.Count();
        }
    }

    //TODO: replace it with the function which gets the states from DB
    internal class StaticStates
    {
        private static StaticStates _instance;
        private readonly List<State> _states = new List<State>();

        private StaticStates()
        {
            #region Add States

            _states.Add(new State("dolnośląskie"));
            _states.Add(new State("kujawsko-pomorskie"));
            _states.Add(new State("lubelskie "));
            _states.Add(new State("lubuskie"));
            _states.Add(new State("łódzkie"));
            _states.Add(new State("małopolskie"));
            _states.Add(new State("mazowieckie"));
            _states.Add(new State("opolskie"));
            _states.Add(new State("podkarpackie"));
            _states.Add(new State("podlaskie"));
            _states.Add(new State("pomorskie"));
            _states.Add(new State("śląskie"));
            _states.Add(new State("świętokrzyskie"));
            _states.Add(new State("warmińsko-mazurskie"));
            _states.Add(new State("wielkopolskie"));
            _states.Add(new State("zachodniopomorskie"));

            #endregion
        }

        public static StaticStates Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new StaticStates();
                }
                return _instance;
            }
        }

        public static List<State> GetStates()
        {
            return Instance._states;
        }

        public static int Count()
        {
            return Instance._states.Count;
        }
    }
}