def get_playbook_dependencies(playbook):
    """
    Gets playbook dependencies(integrations, playbooks, scripts and commands) from playbook object.
    :param playbook: the playbook object.
    :return: the method returns 4 lists - integrations, playbooks, scripts and commands.
    """
    integrations = set()
    scripts = set()
    commands = set()
    playbooks = set()

    playbook_tasks = playbook.get('tasks')
    for task in playbook_tasks:
        task = playbook_tasks[task]['task']
        if task['iscommand']:
            integration = task['script']
            integration = integration.split('|||')
            if integration[0]:
                integrations.add(integration[0])
            commands.add(integration[1])
        else:
            script_name = task.get('scriptName')
            if script_name:
                scripts.add(script_name)
            elif task.get('type') == 'playbook':
                playbooks.add(task.get('name'))

    return list(playbooks), list(integrations), list(scripts), list(commands)