import type { MonitorType, Monitor, MonitorStatus, MonitorsSummary, CheckSnapshot, MonitorScheduleFields } from "@/domain/monitors/monitor.type.js"; export interface TeamQueryConfig { limit?: number; type?: MonitorType | MonitorType[]; tags?: string | string[]; page?: number; rowsPerPage?: number; filter?: string; field?: string; order?: "asc" | "desc"; } export interface SummaryConfig { type?: MonitorType | MonitorType[]; tags?: string | string[]; } export type RecentChecksMode = "all" | "latestHardware" | "none"; export interface IMonitorsRepository { // create create(monitor: Monitor, teamId: string, userId: string): Promise; createMonitors(monitors: Monitor[]): Promise; // single fetch findById(monitorId: string, teamId: string): Promise; // for workers, don't need all details findByIdLean(monitorId: string): Promise; // collection fetch findAllForScheduling(): Promise; findByTeamId(teamId: string, config: TeamQueryConfig, options?: { includeRecentChecks?: boolean }): Promise; findByTeamIdWithStats(teamId: string, config: TeamQueryConfig): Promise; findByIds(monitorIds: string[], options?: { recentChecks?: RecentChecksMode }): Promise; // update updateById(monitorId: string, teamId: string, updates: Partial, options?: { unsetProxyId?: boolean }): Promise; updateByIds(monitorIds: string[], teamId: string, updates: Partial, excludeStatuses?: MonitorStatus[]): Promise; updateStatusWindowAndChecks( monitorId: string, teamId: string, status: boolean, checkSnapshot: CheckSnapshot, windowSize: number, maxRecentChecks: number, statusPatch?: Partial ): Promise; togglePauseById(monitorId: string, teamId: string): Promise; bulkTogglePause(monitorIds: string[], teamId: string, pause: boolean): Promise; // delete deleteById(monitorId: string, teamId: string): Promise; deleteByTeamId(teamId: string): Promise<{ monitors: Monitor[]; deletedCount: number }>; // counts findMonitorCountByTeamIdAndType(teamId: string, config: TeamQueryConfig): Promise; findMonitorCountByProxyId(proxyId: string): Promise; // Docker TLS findDockerTlsKeyById(monitorId: string): Promise; findAllDockerTlsKeys(): Promise<{ id: string; dockerTlsKey: string }[]>; updateDockerTlsKey(monitorId: string, dockerTlsKey: string): Promise; // Needed for worker to rotate keys, no teamId/userId // other findMonitorsSummaryByTeamId(teamId: string, config?: SummaryConfig): Promise; removeNotificationFromMonitors(notificationId: string): Promise; removeTagFromMonitors(tagId: string): Promise; updateNotifications(teamId: string, monitorIds: string[], notificationIds: string[], action: "add" | "remove" | "set"): Promise; deleteByTeamIdsNotIn(teamIds: string[]): Promise; findAllMonitorIds(): Promise; }