| | | 1 | | namespace Pomodoro.Web.Models; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents the result of an import operation with detailed statistics |
| | | 5 | | /// </summary> |
| | | 6 | | public class ImportResult |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Indicates whether the import operation was successful |
| | | 10 | | /// </summary> |
| | 156 | 11 | | public bool Success { get; set; } |
| | | 12 | | |
| | | 13 | | /// <summary> |
| | | 14 | | /// Error message if the import failed |
| | | 15 | | /// </summary> |
| | 40 | 16 | | public string? ErrorMessage { get; set; } |
| | | 17 | | |
| | | 18 | | /// <summary> |
| | | 19 | | /// Number of activities that were successfully imported |
| | | 20 | | /// </summary> |
| | 139 | 21 | | public int ActivitiesImported { get; set; } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Number of activities that were skipped due to duplicates |
| | | 25 | | /// </summary> |
| | 129 | 26 | | public int ActivitiesSkipped { get; set; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Number of tasks that were successfully imported |
| | | 30 | | /// </summary> |
| | 134 | 31 | | public int TasksImported { get; set; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Number of tasks that were skipped due to duplicates |
| | | 35 | | /// </summary> |
| | 130 | 36 | | public int TasksSkipped { get; set; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Indicates whether settings were imported |
| | | 40 | | /// </summary> |
| | 91 | 41 | | public bool SettingsImported { get; set; } |
| | | 42 | | |
| | | 43 | | /// <summary> |
| | | 44 | | /// Total number of records imported (activities + tasks) |
| | | 45 | | /// </summary> |
| | 12 | 46 | | public int TotalImported => ActivitiesImported + TasksImported; |
| | | 47 | | |
| | | 48 | | /// <summary> |
| | | 49 | | /// Total number of records skipped due to duplicates |
| | | 50 | | /// </summary> |
| | 10 | 51 | | public int TotalSkipped => ActivitiesSkipped + TasksSkipped; |
| | | 52 | | |
| | | 53 | | /// <summary> |
| | | 54 | | /// Creates a failed import result with an error message |
| | | 55 | | /// </summary> |
| | 14 | 56 | | public static ImportResult Failed(string errorMessage) => new() |
| | 14 | 57 | | { |
| | 14 | 58 | | Success = false, |
| | 14 | 59 | | ErrorMessage = errorMessage |
| | 14 | 60 | | }; |
| | | 61 | | |
| | | 62 | | /// <summary> |
| | | 63 | | /// Creates a successful import result |
| | | 64 | | /// </summary> |
| | | 65 | | public static ImportResult Succeeded(int activitiesImported, int activitiesSkipped, |
| | 74 | 66 | | int tasksImported, int tasksSkipped, bool settingsImported) => new() |
| | 74 | 67 | | { |
| | 74 | 68 | | Success = true, |
| | 74 | 69 | | ActivitiesImported = activitiesImported, |
| | 74 | 70 | | ActivitiesSkipped = activitiesSkipped, |
| | 74 | 71 | | TasksImported = tasksImported, |
| | 74 | 72 | | TasksSkipped = tasksSkipped, |
| | 74 | 73 | | SettingsImported = settingsImported |
| | 74 | 74 | | }; |
| | | 75 | | } |