using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DuckModel
{
    public interface IFlyBehaviour
    {
        string Fly();
    }
    
    public interface IQuackBehaviour
    {
        string Quack();
    }
    public abstract class DuckBehaviour
    {
        IFlyBehaviour _flyBehaviour;
        IQuackBehaviour _quackBehaviour;

        public void Swim()
        {
            Console.WriteLine("The duck swims");
        }

        public abstract void Display();

        public string PerformQuack()
        {
            return _quackBehaviour.Quack();
        }

        public string PerformFly()
        {
            return _flyBehaviour.Fly();
        }

        protected void SetFlyBehaviour(IFlyBehaviour flyBehaviour)
        {
            _flyBehaviour = flyBehaviour;
        }

        protected void SetQuackBehaviour(IQuackBehaviour newBehaviour)
        {
            _quackBehaviour = newBehaviour;
        }
    }

    class Quack : IQuackBehaviour
    {
        string IQuackBehaviour.Quack()
        {
            return "The duck quacks";
        }
    }

    class Squeak : IQuackBehaviour
    {
        string IQuackBehaviour.Quack()
        {
            return "The duck squeaks";
        }
    }

    class MuteQuack : IQuackBehaviour
    {
        string IQuackBehaviour.Quack()
        {
            return "The duck makes no sound";
        }
    }

    class FlyWithWings : IFlyBehaviour
    {
        public string Fly()
        {
            return "I can fly with my wings";
        }
    }

    class NoFly : IFlyBehaviour
    {
        public string Fly()
        {
            return  "I cannot fly";
        }
    }
}
