# ws_package/entities/activity_entity.py

from datetime import datetime
from typing import Optional
from typing import List
from pydantic import BaseModel


class ActivityEntity(BaseModel):
    keyboard_count: int
    keyboard_activity: list
    mouse_click_count: int
    mouse_activity: list
    timestamp: datetime


class ActivityLogEntity(BaseModel):
    request_data: dict
    is_uploaded: bool
    start_time: datetime
    end_time: datetime
    timestamp: datetime


class LocationEntity(BaseModel):
    long: str
    lat: str


class ActivityLogRequestEntity(BaseModel):
    Entry: int
    from_date: str
    to_date: str
    screenUrl: list
    activityLevel: dict
    appAndUrls: List[dict]
    location: Optional[LocationEntity] = None
    interval_time_db: Optional[str] = "10"
    deviceType: str
    deviceId: Optional[str] = ""
    ip_address: Optional[str] = ""
    os_version: Optional[str] = ""
    idleInterval: Optional[str] = None
    break_id: Optional[str] = None
    os_type: Optional[str] = ""


class ActivityIntervalEntity(BaseModel):
    start_time: datetime
    end_time: datetime
    is_uploaded: bool
    activityLevel: dict
    counter:int
    weekday: str
    is_break: int = 0  # Stores break_id value (0 if no break)
    is_idle: bool = False  # True when idle popup is active, False otherwise
    has_on_demand_screenshot: bool = False  # True when an on-demand screenshot was captured in this interval

class ActivityPercentageEntity(BaseModel):
    start: datetime
    stop: datetime
    keyboard: float
    mouse: float
    average: float
    minute: int