﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Messaging;
using JetBrains.Annotations;
using KMBEditor.DomainLayer;
using KMBEditor.DomainLayer.Service.Properties;
using KMBEditor.UseCaseLayer;
using Reactive.Bindings;
using Reactive.Bindings.Extensions;

namespace KMBEditor.PresentationLayer.Main.ViewModel
{
    /// <summary>
    ///     MainWindow の ViewModel
    /// </summary>
    // ReSharper disable once ClassNeverInstantiated.Global
    public class MainWindowViewModel : ViewModelBase
    {
        /// <summary>
        ///     コンストラクタ
        /// </summary>
        public MainWindowViewModel([NotNull] ApplicationPropertiesService applicationPropertiesService)
            : base(Messenger.Default)
        {
            Title = applicationPropertiesService.ObserveProperty(p => p.SystemName).ToReactiveProperty();
            TitleMessage = applicationPropertiesService.ObserveProperty(p => p.TitleMessage).ToReactiveProperty();
        }

        /// <summary>
        ///     タイトル名
        /// </summary>
        public ReactiveProperty<string> Title { get; }

        /// <summary>
        ///     タイトル横のメッセージ領域テキスト
        /// </summary>
        public ReactiveProperty<string> TitleMessage { get; }
    }
}