#!/usr/bin/python3
"""Class Rectangle will inherit from Base
"""
from models.base import Base


class Rectangle(Base):
    """Rectangle Class"""
    def __init__(self, width, height, x=0, y=0, id=None):
        """Init method"""
        self.width = width
        self.height = height
        self.x = x
        self.y = y
        super().__init__(id)

    @property
    def width(self):
        """getter for width"""
        return self.__width

    @width.setter
    def width(self, value):
        """setter for width"""
        if isinstance(value, int) is False:
            raise TypeError("width must be an integer")
        if value < 0 or value == 0:
            raise ValueError("width must be > 0")
        self.__width = value

    @property
    def height(self):
        """getter for height"""
        return self.__height

    @height.setter
    def height(self, value):
        """setter for height"""
        if isinstance(value, int) is False:
            raise TypeError("height must be an integer")
        if value < 0 or value == 0:
            raise ValueError("height must be > 0")
        self.__height = value

    @property
    def x(self):
        """getter for x"""
        return self.__x

    @x.setter
    def x(self, value):
        """setter for x"""
        if isinstance(value, int) is False:
            raise TypeError("x must be an integer")
        if value < 0:
            raise ValueError("x must be >= 0")
        self.__x = value

    @property
    def y(self):
        """getter for y"""
        return self.__y

    @y.setter
    def y(self, value):
        """setter for y"""
        if isinstance(value, int) is False:
            raise TypeError("y must be an integer")
        if value < 0:
            raise ValueError("y must be >= 0")
        self.__y = value

    def area(self):
        """area method"""
        return self.__width * self.__height

    def display(self):
        """Display method"""
        for row in range(self.__y):
            print()
        x = (" " * self.__x)
        for row in range(self.__height):
            print(x, end="")
            for col in range(self.__width):
                print("#", end="")
            print()

    def __str__(self):
        """str method"""
        return ("[Rectangle] ({}) {}/{} - {}/{}".format
                (self.id, self.x, self.y, self.width, self.height))

    def update(self, *args, **kwargs):
        """Update method"""
        if len(args) is not 0 and args is not None:
            for position, arg in enumerate(args):
                if position is 0:
                    self.id = arg
                if position is 1:
                    self.width = arg
                if position is 2:
                    self.height = arg
                if position is 3:
                    self.x = arg
                if position is 4:
                    self.y = arg
        else:
            self.id = kwargs.get("id", self.id)
            self.width = kwargs.get("width", self.width)
            self.height = kwargs.get("height", self.height)
            self.x = kwargs.get("x", self.x)
            self.y = kwargs.get("y", self.y)

    def to_dictionary(self):
        """dict method"""
        new_dict = ({'id': self.id, 'width': self.width, 'height':
                    self.height, 'x': self.x, 'y': self.y})
        return new_dict
