import secrets


class Password:
    def __init__(self):
        """
        The __init__ function is called when an instance of the class is created.
        It initializes all the variables that are part of that instance.

        Parameters
        ----------
            self
                Refer to the object itself

        Returns
        -------

            Nothing

        Doc Author
        ----------
            Trelent
        """
        self.lenght = 15
        self.ASCII_LETTERS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
        self.DIGITS = '0123456789'
        self.PUNCTUATION = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
        self.ALPHABET = self.ASCII_LETTERS + self.DIGITS + self.PUNCTUATION

    def generate_password(self, lenght=15):
        """
        The generate_password function generates a random password consisting of uppercase letters,
        lowercase letters, punctuation characters numbers from 0 to 9
        with an optional size parameter with a default value equal to 15.

        Parameters
        ----------
            self
                Access variables that belongs to the class
            lenght=15
                Define the size of the password that will be generated

        Returns
        -------

            A string of random characters

        Doc Author
        ----------
            Trelent
        """
        self.lenght = lenght
        pwd = ''
        for i in range(self.lenght):
            pwd += ''.join(secrets.choice(self.ALPHABET))
        return pwd

    def generate_password_digits(self, lenght=15):
        """
        The generate_password_digits function generates a random password consisting of numbers from 0 to 9
        with an optional size parameter with a default value equal to 15. The function returns the password generated by the function

        Parameters
        ----------
            self
                Access variables that belongs to the class
            lenght=15
                Set the default value of 15 for the lenght parameter

        Returns
        -------

            A string of numbers from 0 to 9 with a default lenght equal to 15

        Doc Author
        ----------
            Trelent
        """
        self.lenght = lenght
        pwd = ''
        for i in range(self.lenght):
            pwd += ''.join(secrets.choice(self.DIGITS))
        return pwd

    def generate_password_letters(self, lenght=15):
        """
        The generate_password_letters function generates a random password consisting of uppercase letters,
        lowercase letters with an optional size parameter with a default value equal to 15.


        Parameters
        ----------
            self
                Reference the class itself
            lenght=15
                Set the lenght of the password to 15, if no value is passed it will be equal to 15

        Returns
        -------

            A random password consisting of uppercase letters, lowercase letters with an optional size parameter with a default value equal to 15

        Doc Author
        ----------
            Trelent
        """
        self.lenght = lenght
        pwd = ''
        for i in range(self.lenght):
            pwd += ''.join(secrets.choice(self.ASCII_LETTERS))
        return pwd

    def generate_password_punct(self, lenght=15):
        """
        The generate_password_punct function generates a random password consisting of punctuation characters.


        Parameters
        ----------
            self
                Allow the function to refer to itself
            lenght=15
                Set the default value for the lenght of the password

        Returns
        -------

            A password consisting of punctuation characters

        Doc Author
        ----------
            Trelent
        """
        self.lenght = lenght
        pwd = ''
        for i in range(self.lenght):
            pwd += ''.join(secrets.choice(self.PUNCTUATION))
        return pwd

