"""
Module for a RightAngleTriangle.
"""
from point import Point
from shape import Shape
from typing import List


class RightAngleTriangle(Shape):
    """
    A Right Triangle shape that can draw itself, move, and report area and perimeter.

    """

    def __init__(self, corners:List['Point'])->None:
        """ Create RightAngleTriangle self with vertices corners.

        Assume corners[0] is the 90 degree angle.

        Extended from Shape.

        @type self: RightAngleTriangle
        @type corners: list[Point]
        @rtype: None

        >>> s = RightAngleTriangle([Point(0, 0), Point(1, 0), Point(0, 2)])
        """
        super().__init__(corners)
        #Shape.__init__(self, corners)

    def _set_area(self)->None:
        """
        Sets the area for the Triangle
        Overrides Shape._set_area

        @param self RightAngleTriangle: THis triangle
        @rtype: float

        """
        self._area = (self.corners[0].distance(self.corners[2]) *
                      self.corners[0].distance(self.corners[1]) * 0.5)


if __name__ == '__main__':
    import doctest
    doctest.testmod()

    s = RightAngleTriangle([Point(0, 0), Point(100, 0), Point(0, 100)])
    s.draw()
    s.move_by(Point(100,150))
    print(s.perimeter)
    #s.area = 1000 # ==> will produce an exception - not allowed to set area