using Valg.EVA.Skanning.Identity;

namespace Valg.EVA.Skanning.JobManagement.Startup.UI
{
    public class MainViewModel : ReactiveViewModel, IMainViewModel
    {
        private readonly IIdentityProvider identityProvider;

        public MainViewModel(
            IIdentityProvider identityProvider)
        {
            this.identityProvider = identityProvider;
        }

        public string Heading
        {
            get
            {
                var role = identityProvider.CurrentSelectedRole;
                if (role == null)
                    return string.Empty;

                if (role.IsSubArea)
                {
                    return string.Format(
                        "{0} | {1} | {2} | {3}",
                        Valg.EVA.Skanning.Resources.Language.JobManagementLanguageString.JobManagement_Title,
                        role.ElectionName,
                        role.CountyArea.AreaName,
                        role.Area.AreaName);
                }
                else
                {
                    return string.Format("{0} | {1} | {2}",
                        Valg.EVA.Skanning.Resources.Language.JobManagementLanguageString.JobManagement_Title,
                        role.ElectionName,
                        role.Area.AreaName);
                }
            }
        }
    }
}
