from faker import Faker
from ..instance import SNowInstance

fake = Faker()

from .utils import table_api_call

def create_incident(
    instance: SNowInstance,
    incident_number: int,
    caller_sys_id: str,
    category: str,
    impact: int,
    urgency: int,
    priority: int,
    incident_hastag: str = None,
    assigned_to: str = None,
):
    incident_config = {
        "task_effective_number": incident_number,


import json
import time

from faker import Faker

fake = Faker()

from .cost_center import get_cost_center_sysid
from .utils import table_api_call

from ..instance import SNowInstance

def create_expense_line(
    instance: SNowInstance,
    amount: float,
    number: str,
    date: str,
    short_description: str = None,
    expense_hashtag: str = "",
    task_sys_id: str = None,


import warnings
from faker import Faker

fake = Faker()

from .utils import table_api_call

from ..instance import SNowInstance

def create_category(
    instance: SNowInstance,
    list_name: str,
    category_name: str = None,
) -> list[str]:
    """
    NOTE: This function creates a new category in the given list. Because categories are in a drop-down list, adding more
    categories will make the list longer and this will affect the difficulty of the task. Use only if you are certain you know
    what you are doing.

    Create a category for a given list


"""
A demonstration of how observation/action traces can be extracted
for WorkArena tasks without modifying the task code.

Author: Alexandre Drouin (alexandre.drouin@servicenow.com)

Notes:
- This approach relies on monkey patching the playwright actions to log the actions and observations.
  It has not been tested for parallel execution. It might work with multiprocessing, but it will for
  sure not work with multithreading.

"""

import importlib
import logging
import os
import pickle
import playwright.sync_api as playwright_sync

from browsergym.core.env import BrowserEnv
from browsergym.workarena import ALL_WORKARENA_TASKS


"""
Human Evaluation - Create the curriculum for all humans

Note: This script separates the tasks among 14 evaluators.
      A 15th one was added subsequently to solve tasks that
      had not been completed by the initial 14 (e.g., due
      to some issues with the annotation UI).

"""

import random

from browsergym.workarena import get_all_tasks_humans

tasks_l2 = get_all_tasks_humans(filter="l2", meta_seed=42)
tasks_l3 = get_all_tasks_humans(filter="l3", meta_seed=42)

tasks = tasks_l2 + tasks_l3
random.shuffle(tasks)