package domain import "time" type AuditSource string const ( SourceTelegram AuditSource = "telegram" SourceWeb AuditSource = "web" SourceWorker AuditSource = "worker" SourceCLI AuditSource = "cli" ) // Tipos de evento gravados em audit_logs. const ( EventUserRegistered = "user_registered" EventUserActivated = "user_activated" EventUserDisabled = "user_disabled" EventBotAdminChanged = "bot_admin_changed" EventScheduleChanged = "schedule_changed" EventUserWindowChanged = "user_window_changed" EventCredentialsChanged = "credentials_changed" EventCredentialsTested = "credentials_tested" EventNotificationsEnabled = "notifications_enabled" EventNotificationsDisabled = "notifications_disabled" EventNotificationsPausedAPI = "notifications_paused_api_failure" EventPointAPIFailure = "point_api_failure" EventPointAPIOutageStarted = "point_api_outage_started" EventPointAPIOutageEnded = "point_api_outage_ended" EventInvalidPointHistory = "invalid_point_history" EventInvalidWorkday = "invalid_workday_calculation" EventNotificationScheduled = "notification_scheduled" EventNotificationSent = "notification_sent" EventNotificationFailed = "notification_failed" EventNotificationExpired = "notification_expired" EventNotificationCancelled = "notification_cancelled" EventNotificationResent = "notification_resent" EventInterruptedSending = "notification_interrupted" EventDayNoPoints = "day_no_points" EventDayNotWorked = "day_not_worked" EventDayResumed = "day_resumed" EventHolidaySyncFailed = "holiday_sync_failed" EventHolidaySynced = "holiday_synced" EventHolidayAdded = "holiday_added" EventHolidayRemoved = "holiday_removed" EventSettingsChanged = "settings_changed" EventWebLogin = "web_login" EventWebLoginFailed = "web_login_failed" EventWebLogout = "web_logout" EventWebAccountCreated = "web_account_created" EventWebAccountChanged = "web_account_changed" EventWebAccountDeleted = "web_account_deleted" EventWebPasswordReset = "web_password_reset" EventRetentionApplied = "retention_applied" EventEncryptionKeyRotated = "encryption_key_rotated" EventTelegramFailure = "telegram_failure" EventScheduleWindowViolation = "schedule_window_violation" ) // AuditEntry é um evento a ser gravado. Details nunca deve conter segredos. type AuditEntry struct { Source AuditSource ActorUserID *int64 ActorAccount *int64 TargetUserID *int64 EventType string Success bool Details map[string]any } // AuditLog é um evento lido do banco, com nomes para exibição. type AuditLog struct { ID int64 OccurredAt time.Time Source AuditSource ActorUserID *int64 ActorUserName *string ActorAccount *int64 ActorUsername *string TargetUserID *int64 TargetUserName *string EventType string Success bool Details map[string]any }