using SewerStammGen.Shared.Domain;
using SewerStammGen.Shared.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace StammGenerator.ViewModel
{
    
    public class ProjektSettingsViewModel : BaseViewModel
    {
        private Visibility _xmlVisible;
        private Visibility _kandisVisible;
        private ESelectedNorm _selectedNorm;
        private EKodierungssystem _selectedKodier;
        private Projekt _projekt = new Projekt();

        
        
        public ESelectedNorm SelectedNorm
        {
            get => _selectedNorm;
            set
            {
                if(_selectedNorm != value)
                {
                    _selectedNorm = value;
                    OnPropertyChanged();
                }
            }
        }
        public EExportType SelectedExport
        {
            get => _projekt.ExportType;
            set
            {
                if(value != _projekt.ExportType)
                {
                    _projekt.ExportType = value;

                    if (_projekt.ExportType == EExportType.KANDIS)
                    {
                        KandisVisible = Visibility.Visible;
                        XmlVisible = Visibility.Collapsed;
                    }
                    else if(_projekt.ExportType == EExportType.XML)
                    {
                        XmlVisible = Visibility.Visible;
                        KandisVisible = Visibility.Collapsed;
                    }

                    OnPropertyChanged();
                    
                }
            }
        }
        public EKodierungssystem SelectedKodier
        {
            get => _selectedKodier;
            set
            {
                if(_selectedKodier != value)
                {
                    _selectedKodier = value;
                    OnPropertyChanged();
                }
            }
        }


        public Visibility XmlVisible
        {
            get => _xmlVisible;
            set
            {
                if(_xmlVisible != value)
                {
                    _xmlVisible = value;
                    OnPropertyChanged();
                }
            }
        }
        public Visibility KandisVisible
        {
            get => _kandisVisible;
            set
            {
                if(_kandisVisible != value)
                {
                    _kandisVisible = value;
                    OnPropertyChanged();
                }
            }
        }

        
        public Projekt Projekt
        {
            get => _projekt;
            set
            {
                if(value != _projekt)
                {
                    _projekt = value;
                    //SelectedExport = _projekt.ExportType;
                    if(_projekt.ExportType == EExportType.KANDIS)
                    {
                        _kandisVisible = Visibility.Visible;
                        _xmlVisible = Visibility.Collapsed;
                    }
                    else if(_projekt.ExportType == EExportType.XML)
                    {
                        _xmlVisible = Visibility.Visible;
                        _kandisVisible = Visibility.Collapsed;
                    }
                    OnPropertyChanged();
                    OnPropertyChanged(nameof(SelectedNorm));
                    OnPropertyChanged(nameof(SelectedExport));
                    OnPropertyChanged(nameof(KandisVisible));
                    OnPropertyChanged(nameof(XmlVisible));
                }
            }
        }


        public ProjektSettingsViewModel()
        {
            //SelectedExport = EExportType.XML;
            //this.Projekt = new Projekt();
        }

    }
}
