from ..snowflake.base import SnowflakeJob
from datetime import datetime, timezone
from src.utils.database import write_to_snowflake
from src.utils.snowflake.constants import QueryType, Role, Warehouse
from .constants import JobGroup
from dagster import OpExecutionContext
from typing import Optional
import pandas as pd
import os
import requests
import asyncio
import aiohttp
import time


class BotStatusChanges(SnowflakeJob):
    def __init__(self):
        super().__init__(
            name="bot_status_changes",
            description="Records changes in user bot classification status, including which features triggered the change and when it occurred. Used for auditing, analyzing false positives, and tracking bot detection effectiveness over time",
            query_file="../bots/queries/bot_status_changes.sql",
            query_type=QueryType.SELECT,
            warehouse=Warehouse.SMALL,
            role=Role.ACCOUNTADMIN,
            group_name="bots",
            # monitored=True,
            owners=["team:core-pod"],
            metadata={
                "slack": "#tech-anti-bots",
            },
            tags={"team": "core-pod", "category": "bots", "tech-alerts": "true"},
            deps=["bots_hourly"],
        )


bots_hourly = BotStatusChanges()
