using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DuckModel;

namespace Duck_Simulator
{
    public partial class Form1 : Form
    {
        private DuckTypes _selectedDuck = DuckTypes.Default;
        private DuckBehaviour _duck;

        public Form1()
        {
            InitializeComponent();

            
        }

        void test()
        {
            radioButton1.Checked = true;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            switch (_selectedDuck)
            {
                case DuckTypes.Mallard:
                    if (!(_duck is MallardDuck))
                    {
                        _duck = new MallardDuck();
                    }
                    break;
                case DuckTypes.Redhead:
                    if (!(_duck is RedheadDuck))
                    {
                        _duck = new RedheadDuck();
                    }
                    break;
                case DuckTypes.Rubber:
                    if (!(_duck is RubberDucky))
                    {
                        _duck = new RubberDucky();
                    }
                    break;
                case DuckTypes.Decoy:
                    if (!(_duck is DecoyDuck))
                    {
                        _duck = new DecoyDuck();
                    }
                    break;
                default:

                    // Show msg box
                    MessageBox.Show("Not a valid duck");
                    return;
            }
            

            string msg = _duck.PerformQuack();
            MessageBox.Show(msg);
        }

        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            if ((sender as RadioButton).Checked)
                _selectedDuck = DuckTypes.Mallard;
        }

        private void radioButton4_CheckedChanged(object sender, EventArgs e)
        {
            _selectedDuck = DuckTypes.Decoy;
        }

        private void radioButton3_CheckedChanged(object sender, EventArgs e)
        {
            _selectedDuck = DuckTypes.Rubber;
        }

        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            _selectedDuck = DuckTypes.Redhead;
        }
    }
}
