namespace Febe.Web.Api; // JSON shapes of the second part of the interface (Attività, Impostazioni, Importa, Collegamento, Browser, doppioni). // Same conventions as Dtos.cs: English camelCase names, Italian texts, times as Unix milliseconds or LocalTimeDto. // ---------------------------------------------------------------- connection (PROTOCOLLO.md) /// GET /api/connection. : notConnected, connected, verificationRequired, browserUnavailable. public sealed record ConnectionStatusDto(string State, string? Username, string? DisplayName, bool UserIsDriving, string? CurrentUrl); /// POST /api/connection/begin. public sealed record BeginDrivingRequest(bool OpenLogin); /// POST /api/connection/finish. public sealed record FinishDto(bool Connected, string Message); // ---------------------------------------------------------------- activity /// A stop of the circuit breaker. : throttle, challenge, disconnect. public sealed record IncidentDto( long Id, LocalTimeDto At, string Level, string Title, string Signal, string? Url, LocalTimeDto? StoppedUntil, LocalTimeDto? ResolvedAt, bool Open, string? Note); /// «Tre rallentamenti in sette giorni»: the proposal of spec §7.6, or null. public sealed record IncidentListDto(IReadOnlyList Items, int ThrottlesLastWeek, string? Advice); /// /// A line of the «Avvisi» list of Attività (spec §13.3): an alert or a failed delivery. : /// verification, disconnection, throttleStop, throttleEnd, backfillDone, unknownFormat, recipeSuspended, diskLow, /// deliveryFailed. : error, warning, success, info. /// public sealed record AlertItemDto(long Id, LocalTimeDto At, string Kind, string Level, string Title, string Message, long? AccountId); /// GET /api/alerts: the alerts of the last days, newest first. public sealed record AlertListDto(IReadOnlyList Items, int Days); /// The preview of Febe's browser: is the address of the JPEG (with a version), or null. public sealed record BrowserPreviewDto(bool HasFrame, string? Url, long? At, string? Frame); /// Probable duplicates waiting for a decision, by origin. public sealed record DuplicateCountsDto(int Download, int Import); // ---------------------------------------------------------------- settings: general /// A folder with the free space of its disk and the space it uses (measured in the background). public sealed record FolderInfoDto(string Path, long? FreeBytes, long? UsedBytes, bool Measuring); public sealed record NamingPreviewFileDto(string Name, string Kind); public sealed record NamingPreviewFolderDto(IReadOnlyList Path, IReadOnlyList Files); /// The «Risultato» tree of mockup 08 and the problems of the three schemes. public sealed record NamingPreviewDto(string AccountFolder, IReadOnlyList Folders, IReadOnlyList Errors, IReadOnlyList Warnings); /// Impostazioni, Generali (mockup 08). /// Windows: «Avvia Febe all'accensione del computer»; null where it does not exist. /// Windows: «Chiudendo la finestra, Febe resta attivo nell'area di notifica». public sealed record GeneralSettingsDto( FolderInfoDto Library, FolderInfoDto Data, bool FoldersReadOnly, bool CanPickFolder, bool CanChangeDataFolder, string NamingScheme, string HighlightScheme, string ProfilePictureScheme, string DefaultNamingScheme, string DefaultHighlightScheme, string DefaultProfilePictureScheme, IReadOnlyList Placeholders, bool SetFileTime, NamingPreviewDto Preview, bool? Autostart, bool KeepInTray, string Language); /// /// Saves Impostazioni, Generali. A null keeps the library folder; a null /// keeps the scheme of profile pictures. /// public sealed record GeneralSettingsRequest(string? LibraryFolder, string NamingScheme, string HighlightScheme, bool SetFileTime, bool? Autostart, bool? KeepInTray, string? ProfilePictureScheme = null); /// The schemes to preview; a null stands for the default one. public sealed record NamingRequest(string? NamingScheme, string? HighlightScheme, string? ProfilePictureScheme = null); /// : library or data. public sealed record PickFolderRequest(string Which); /// A path; null or empty when Alberto cancelled the picker. public sealed record PathDto(string? Path); public sealed record PathRequest(string Path); // ---------------------------------------------------------------- settings: limits (mockup 07) /// A budget of a category (ActionKind names, as in the engine snapshot) with the most the interface accepts. public sealed record BudgetValueDto(string Kind, string Label, int PerHour, int PerDay, int MaxPerHour, int MaxPerDay); /// The values of a caution profile. : prudent, balanced, fast, custom. Times «07:30». public sealed record ProfileValuesDto( string Kind, string Name, string WindowStart, string WindowEnd, int JitterMinutes, int SessionMinMinutes, int SessionMaxMinutes, int PauseMinMinutes, int PauseMaxMinutes, IReadOnlyList Budgets, double DataPerDayGb, int BackfillPerAccount, int RampUpDays); /// The limits of spec §7.5 that the interface enforces. public sealed record LimitRulesDto(int MinPauseMinutes, int MaxSessionMinutes, int MaxWindowHours, int MaxJitterMinutes, double MaxDataPerDayGb, int MaxBackfillPerAccount, int MaxRampUpDays); /// Impostazioni, Limiti e comportamento. : slow, natural, brisk. Days: 0 Sunday … 6 Saturday. /// The fixed stops after throttles, informative only: «1 ora», «6 ore», «24 ore». public sealed record LimitsDto( string Profile, IReadOnlyList Presets, ProfileValuesDto Current, string Pace, bool GradualStart, IReadOnlyList ActiveDays, LimitRulesDto Rules, IReadOnlyList Stops); /// Saves the limits; is read when is custom. public sealed record LimitsRequest(string Profile, ProfileValuesDto? Values, string Pace, bool GradualStart, IReadOnlyList ActiveDays); // ---------------------------------------------------------------- settings: notifications (spec §13.3) public sealed record AlertEventsDto(bool Verification, bool Disconnection, bool Throttle, bool BackfillDone, bool DiskLow, bool UnknownFormat); /// The token is never sent back: only whether it is set. public sealed record NotificationSettingsDto(AlertEventsDto Events, bool Windows, bool WindowsAvailable, string? TelegramChatId, bool TelegramTokenSet, bool TelegramAvailable); /// /// Saves the notifications. : null or empty keeps the stored token, a value replaces it; /// removes it. /// public sealed record NotificationSettingsRequest(AlertEventsDto Events, bool Windows, string? TelegramChatId, string? TelegramToken, bool RemoveTelegramToken); /// : telegram or windows. public sealed record AlertTestRequest(string Channel); public sealed record AlertTestDto(bool Sent, string Message); // ---------------------------------------------------------------- settings: data and backups (spec §8.2, §8.5) public sealed record BackupDto(string Day, string Name, long Bytes, LocalTimeDto Modified); /// The rebuild of the database: progress while running, then the report as Italian lines. public sealed record RebuildStatusDto(bool Running, string? Folder, int FoldersDone, int FoldersTotal, int FilesChecked, IReadOnlyList Lines, string? Error, LocalTimeDto? FinishedAt); public sealed record DataSettingsDto(FolderInfoDto Data, string Database, long? DatabaseBytes, string BackupsFolder, IReadOnlyList Backups, int KeepDays, RebuildStatusDto Rebuild); /// «Ricostruisci»: must be the word «ricostruisci» typed by Alberto. public sealed record RebuildRequest(string Confirm); /// Impostazioni, Informazioni. public sealed record AboutDto(string Version, string Edition, string DataFolder, string LibraryFolder, string Guide, string Repository); // ---------------------------------------------------------------- probable duplicates (mockup 09, spec §9.5) /// One side of a probable duplicate. is the address of its picture (thumbnail or preview). public sealed record DuplicateSideDto( bool InLibrary, long? MediaId, long? ImportFileId, string? Username, string? Path, string? Kind, int? Width, int? Height, long? Bytes, LocalTimeDto? Date, string? Image); /// A probable duplicate. : sameInstagramId, visuallySimilar. : pending, keepLarger, keepExisting, keepBoth. public sealed record DuplicateCaseDto(long PairId, string Reason, string Decision, DuplicateSideDto Existing, DuplicateSideDto Candidate, bool CandidateIsLarger, bool InsideSource); public sealed record DuplicatePageDto(IReadOnlyList Cases, int Pending); /// A decision. : «Applica a tutti i casi simili» (every pending pair). public sealed record DecideRequest(string Decision, bool ApplyToAll); public sealed record DecideDto(int Decided, int FilesRemoved, IReadOnlyList Problems, string Message, int Pending); // ---------------------------------------------------------------- import (spec §9, mockup 09) /// An import. : analyzing, analysisInterrupted, reviewing, copying, copyInterrupted, completed, cancelled. public sealed record ImportRunDto(long Id, string Source, string DisplayPath, string State, string Mode, bool ReadOnly, LocalTimeDto Started, LocalTimeDto? Completed, string? Error, bool Running); /// Docker: the root of the sources (the page lists its subfolders); null: the native picker. public sealed record ImportOverviewDto(IReadOnlyList Runs, long? ActiveRunId, string? SourceRoot, bool PickFolder); public sealed record SourceFolderDto(string Name, string Path, bool HasSubfolders); /// The folder listed (relative to the root), null for the root itself. /// The folder above, or null at the root. public sealed record SourceListDto(string? Path, string? Parent, string DisplayPath, IReadOnlyList Folders); public sealed record SourceInfoDto(string Path, string DisplayPath, string Name, bool ReadOnly, bool CanMove, bool LooksLikeFebeLibrary, bool LooksLikeStogram, IReadOnlyList Folders); public sealed record ImportStartRequest(string Path, bool Stogram); public sealed record OutcomeCountsDto(int New, int AlreadyInLibrary, int ProbableDuplicates, int Unrecognized, int IdenticalInSource); /// Step 2 and 4. : listing, analyzing, copying, finished. public sealed record ImportProgressDto( long RunId, string Phase, string State, bool Running, int FilesDone, int FilesTotal, long BytesDone, long BytesTotal, double Fraction, string? CurrentFile, OutcomeCountsDto Outcomes, int Copied, string? Error); /// Where a folder goes. : none, existing, newArchiveAccount. public sealed record FolderTargetDto(string Kind, long? AccountId, string? Username); public sealed record ImportFolderDto( string Folder, string DisplayName, string? ProbableAccount, int Files, long Bytes, int New, int AlreadyInLibrary, int ProbableDuplicates, int Unrecognized, int Recognized, FolderTargetDto Target, bool Blocked); public sealed record ImportPlanDto( int ToImport, int ToReplace, int Skipped, int LeftOutNoAccount, int FoldersWithoutAccount, int LeftOutUndecided, int AlreadyDone, long Bytes, string Mode, string ButtonLabel, string? LeftOutLabel); public sealed record AccountChoiceDto(long Id, string Username, string State); /// Step 3 (mockup 09). public sealed record ImportReviewDto( ImportRunDto Run, string DisplayPath, string Headline, int Files, long Bytes, OutcomeCountsDto Outcomes, int Recognized, int PendingDuplicates, IReadOnlyList Folders, ImportPlanDto Plan, bool CanMove, bool StogramHypothesis, int Copied, IReadOnlyList Accounts); /// Sets where a folder goes. : none, existing (with ), newArchiveAccount (with ). public sealed record FolderTargetRequest(string Folder, string Kind, long? AccountId, string? Username); /// : copy or move. public sealed record ImportModeRequest(string Mode); public sealed record ImportCountDto(string Username, int Files); public sealed record ImportNoteDto(string Path, string Note); /// Step 4: the final report. public sealed record ImportReportDto( ImportRunDto Run, string DisplayPath, int Files, long Bytes, OutcomeCountsDto Outcomes, int Copied, int Moved, int Replaced, int Skipped, int LeftOut, int Failed, long BytesCopied, IReadOnlyList ImportedByAccount, IReadOnlyList AlreadyInLibraryByAccount, IReadOnlyList Unrecognized, IReadOnlyList Problems);