using System.Windows.Forms;
using FizzyLauncher.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;

namespace FizzyLauncher.Windows.Forms
{
    public class EditGroupForm : TDialog
    {
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label1;
        private ThButton button1;
        private ThPickerBox pickerBox1;
        private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
        private ThTextBox textBox1;


        public EditGroupForm(TileGroupModel model = null)
        {
            InitializeComponent();

            this.StartPosition = FormStartPosition.WindowsDefaultLocation;
            this.Text = ((model == null) ? "Add Group" : "Edit Group");
            this.OkButton = button1;

            pickerBox1.ComboBox.Items.Clear();
            pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
            if (pickerBox1.ComboBox.Items.Count > 0)
            {
                pickerBox1.ComboBox.SelectedIndex = 0;
            }

            if (model != null)
            {
                textBox1.Text = model.Title?.Trim() ?? string.Empty;
                pickerBox1.ComboBox.SelectedIndex = (model.IsExclusive ? 1 : 0);
            }
        }

        private void InitializeComponent()
        {
            this.textBox1 = new ThTextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.button1 = new ThButton();
            this.pickerBox1 = new ThPickerBox();
            this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
            this.SuspendLayout();
            //
            // textBox1
            //
            this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.textBox1.BackColor = System.Drawing.Color.Transparent;
            this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
            this.textBox1.Location = new System.Drawing.Point(192, 20);
            this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
            this.textBox1.Name = "textBox1";
            this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
            this.textBox1.Size = new System.Drawing.Size(177, 35);
            this.textBox1.AcceptButton = null;
            this.textBox1.TabIndex = 152;
            this.textBox1.UseSystemPasswordChar = false;
            //
            // label2
            //
            this.label2.AutoSize = true;
            this.label2.BackColor = System.Drawing.Color.Transparent;
            this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
            this.label2.Location = new System.Drawing.Point(10, 62);
            this.label2.Name = "label2";
            this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
            this.label2.Size = new System.Drawing.Size(119, 34);
            this.label2.TabIndex = 155;
            this.label2.Text = "Show Only Expanded";
            this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // label1
            //
            this.label1.AutoSize = true;
            this.label1.BackColor = System.Drawing.Color.Transparent;
            this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
            this.label1.Location = new System.Drawing.Point(10, 21);
            this.label1.Margin = new System.Windows.Forms.Padding(0);
            this.label1.Name = "label1";
            this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
            this.label1.Size = new System.Drawing.Size(29, 34);
            this.label1.TabIndex = 153;
            this.label1.Text = "Title";
            this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // button1
            //
            this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.button1.BackColor = System.Drawing.Color.Transparent;
            this.button1.IdleImage = null;
            this.button1.ActiveImage = null;
            this.button1.LabelText = "&Save";
            this.button1.Location = new System.Drawing.Point(241, 469);
            this.button1.Margin = new System.Windows.Forms.Padding(10);
            this.button1.Name = "button1";
            this.button1.HoverImage = null;
            this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
            this.button1.Size = new System.Drawing.Size(128, 32);
            this.button1.TabIndex = 173;
            //
            // pickerBox1
            //
            this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
            this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
            this.pickerBox1.Location = new System.Drawing.Point(285, 62);
            this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
            this.pickerBox1.Name = "pickerBox1";
            this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
            this.pickerBox1.Size = new System.Drawing.Size(84, 34);
            this.pickerBox1.AcceptButton = null;
            this.pickerBox1.TabIndex = 174;
            //
            // horizontalSeparator2
            //
            this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
            this.horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
            this.horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
            this.horizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
            this.horizontalSeparator2.Location = new System.Drawing.Point(10, 437);
            this.horizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
            this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
            this.horizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
            this.horizontalSeparator2.Name = "horizontalSeparator2";
            this.horizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
            this.horizontalSeparator2.Size = new System.Drawing.Size(364, 22);
            this.horizontalSeparator2.TabIndex = 182;
            //
            // EditGroupForm
            //
            this.ClientSize = new System.Drawing.Size(384, 521);
            this.Controls.Add(this.horizontalSeparator2);
            this.Controls.Add(this.pickerBox1);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.textBox1);
            this.MinimumSize = new System.Drawing.Size(400, 560);
            this.Name = "EditGroupForm";
            this.Text = "Edit Group";
            this.ResumeLayout(false);
            this.PerformLayout();

        }


        public TileGroupModel Result
        {
            get => new TileGroupModel()
            {
                Title = textBox1.Text?.Trim() ?? string.Empty,
                IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1)
            };
        }

    }
}