from parallels.core.hosting_repository.panel_user_role import PanelUserRoleModel
from parallels.plesk.hosting_repository.base import PleskBaseModel
from parallels.plesk.hosting_repository.utils.cli.role import RoleCli


class PleskPanelUserRoleModel(PanelUserRoleModel, PleskBaseModel):
    def create(self, role, owner):
        """Create user role in target Plesk

        :type role: parallels.core.target_data_model.AuxiliaryUserRole
        :type owner: parallels.core.target_data_model.Client | parallels.core.target_data_model.Reseller
        """
        command = RoleCli(self.plesk_cli_runner, role, owner)
        command.run()
