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

namespace ConsoleApp2.Bridge
{
    public class BasicRemote: Remote
    {
        Device device;
        public BasicRemote(Device device)
        {
            this.device = device;
        }

        public void setVolume(int volume)
        {
            if (device.isEnabled())
                if (volume < device.getVolume())
                    while (device.getVolume() > volume)
                        device.decreaseVolume();
                else
                    while (device.getVolume() < volume)
                        device.increseVolume();
        }

        public void turnOn()
        {
            if (!device.isEnabled())
                device.enable();
        }

        public void turnOff()
        {
            if (device.isEnabled())
                device.disable();
        }
    }
}
