using PDF_Office.Properties;
using PDFSettings;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;

namespace PDF_Office.Model.SettingsDialog
{
    public class AnnotateModel:BindableBase
    {
        private Color highLightColor;

        public Color HighLightColor
        {
            get { return highLightColor; }
            set
            {
                SetProperty(ref highLightColor, value);
            }
        }

        private Color underLineColor;

        public Color UnderLineColor
        {
            get { return underLineColor; }
            set
            {
                SetProperty(ref underLineColor, value);
            }
        }

        private Color strikethroughColor;

        public Color StrikethroughColor
        {
            get { return strikethroughColor; }
            set
            {
                SetProperty(ref strikethroughColor, value);
            }
        }

        private Color freeHandColor;

        public Color FreeHandColor
        {
            get { return freeHandColor; }
            set
            {
                SetProperty(ref freeHandColor, value);
            }
        }


        private Color textAnnoteColor;

        public Color TextAnnoteColor
        {
            get { return textAnnoteColor; }
            set
            {
                SetProperty(ref textAnnoteColor, value);
            }
        }

        private Color noteAnnoteColor;

        public Color NoteAnnoteColor
        {
            get { return noteAnnoteColor; }
            set
            {
                SetProperty(ref noteAnnoteColor, value);
            }
        }

        private Color rectangleBorderColor;

        public Color RectangleBorderColor
        {
            get { return rectangleBorderColor; }
            set
            {
                SetProperty(ref rectangleBorderColor, value);
            }
        }

        private Color rectangleFillColor;

        public Color RectangleFillColor
        {
            get { return rectangleFillColor; }
            set
            {
                SetProperty(ref rectangleFillColor, value);
            }
        }

        private Color circleBorderColor;

        public Color CircleBorderColor
        {
            get { return circleBorderColor; }
            set
            {
                SetProperty(ref circleBorderColor, value);
            }
        }

        private Color circleFillColor;

        public Color CircleFillColor
        {
            get { return circleFillColor; }
            set
            {
                SetProperty(ref circleFillColor, value);
            }
        }

        private Color lineColor;

        public Color LineColor
        {
            get { return lineColor; }
            set
            {
                SetProperty(ref lineColor, value);
            }
        }

        private TextAlignment textAlign;

        public TextAlignment TextAlign
        {
            get { return textAlign; }
            set
            {
                SetProperty(ref textAlign, value);
            }
        }

        private string textFontFamaily;

        public string TextFontFamaily
        {
            get { return textFontFamaily; }
            set
            {
                SetProperty(ref textFontFamaily, value);
            }
        }

        private string anchoredFamaily;

        public string AnchoredFamaily
        {
            get { return anchoredFamaily; }
            set
            {
                SetProperty(ref anchoredFamaily, value);
            }
        }

        public AnnotateModel()
        {
            InitFromSettings();
        }

        private void InitFromSettings()
        {
            var annote = Settings.Default.AppProperties.Annotate;
            this.HighLightColor = annote.HighLightColor;
            this.UnderLineColor = annote.UnderLineColor;
            this.StrikethroughColor = annote.StrikethroughColor;
            this.FreeHandColor = annote.FreeHandColor;
            this.TextAnnoteColor = annote.TextAnnoteColor;
            this.NoteAnnoteColor = annote.NoteAnnoteColor;
            this.RectangleBorderColor = annote.RectangleBorderColor;
            this.RectangleFillColor = annote.RectangleFillColor;
            this.CircleBorderColor = annote.CircleBorderColor;
            this.CircleFillColor = annote.CircleFillColor;
            this.LineColor = annote.LineColor;
            this.TextFontFamaily = annote.TextFontFamaily;
            this.AnchoredFamaily = annote.AnchoredFamaily;
            this.TextAlign = annote.TextAlign;
        }

        public void Save()
        {
            AnnotatePropertyClass annote = new AnnotatePropertyClass();
            annote.HighLightColor = this.HighLightColor;
            annote.UnderLineColor = this.UnderLineColor;
            annote.StrikethroughColor = this.StrikethroughColor;
            annote.FreeHandColor = this.FreeHandColor;
            annote.TextAnnoteColor = this.TextAnnoteColor;
            annote.NoteAnnoteColor = this.NoteAnnoteColor;
            annote.RectangleBorderColor = this.RectangleBorderColor;
            annote.RectangleFillColor = this.RectangleFillColor;
            annote.CircleBorderColor = this.CircleBorderColor;
            annote.CircleFillColor = this.CircleFillColor;
            annote.LineColor = this.LineColor;
            annote.TextFontFamaily = this.TextFontFamaily;
            annote.AnchoredFamaily = this.AnchoredFamaily;
            annote.TextAlign = this.TextAlign;

            Settings.Default.AppProperties.Annotate = annote;
        }

        public void Reset()
        {
            InitFromSettings();
        }

    }
}