namespace GestionaDenuncias.Shared.Models;

public sealed record ApiLoginResponse(
    string Username,
    string AccessToken,
    DateTimeOffset ExpiresAtUtc,
    string? Role);

public sealed record ApiGlobalLeaksSessionDto(
    string Username,
    string? Role,
    bool HasActiveSession,
    DateTimeOffset? UpdatedAt);

public sealed record RenewGlobalLeaksSessionRequest(string Authcode, string? PendingLoginId = null);

public sealed record InboxSnapshotResponse(
    IReadOnlyList<ContextDto> Contexts,
    IReadOnlyList<ReportDto> Reports,
    InboxUserState UserState);

public sealed record ImportReportRequest(
    ReportDto Report,
    bool ConfirmDifferentOwner = false);

public sealed record MarkFicherosUploadedRequest(
    IReadOnlyList<string> FileNames,
    DateTime UploadedAtUtc);

public sealed record UpsertFicherosRequest(IReadOnlyList<FicherosDenuncias> Ficheros);

public sealed record TrackingSnapshotRequest(
    string Username,
    IReadOnlyList<ReportDto> Reports);

public sealed record MarkReportImportedRequest(
    string Username,
    ReportDto Report,
    int? ComplaintId);

public sealed record MarkReportHandledInGestionaRequest(
    string Username,
    int DenunciaId,
    DateTime UploadedAtUtc);

public sealed record TrackingImportPermissionRequest(
    string Username,
    ReportDto Report,
    bool ConfirmDifferentOwner = false);

public sealed record GestionaCreateFileRequest(
    string Subject,
    string DocumentSeries,
    string SiaCode);

public sealed record GestionaCreateFileResponse(
    string FileUrl,
    string? FileOpenUrl);

public sealed record GestionaOpenFileRequest(
    string FileUrl,
    string? FileOpenUrl,
    string AssignedGroupCode,
    bool Confidential,
    string FreeTitle);

public sealed record GestionaAssignFileRequest(
    string FileUrl,
    string AssignedGroupCode);

public sealed record GestionaEnsureThirdRequest(
    string FileUrl,
    ThirdPartyIdentityData ThirdParty);

public sealed record GestionaEnsureThirdResponse(
    bool Ok,
    IReadOnlyList<string> Warnings);

public sealed record GestionaCreateFolderRequest(
    string FileUrl,
    string FolderName);

public sealed record GestionaCreateFolderResponse(
    Guid FolderId,
    string DocumentsTargetUrl);

public sealed record GestionaUploadDocumentRequest(
    string FileUrl,
    byte[] ContentBytes,
    string FileName);

public sealed record GestionaUploadDocumentResponse(string DocumentUrl);

public sealed record GestionaTramitarDocumentoRequest(
    string DocumentUrl,
    string AssignedGroupCode,
    int? ComplaintId,
    bool IsUpdate = false,
    string? UpdateSource = null);

public sealed record ManualPurgeRequest(string Date);

public sealed record ManualPurgeResponse(
    string Date,
    bool Success,
    int StatusCode,
    string ResponseBody);

public sealed record AppConfigurationDto(
    string? ExternalUpdateCutoffDate,
    string? LatestEncryptionKeyDate = null,
    string? LatestEncryptionKeyStatus = null);

public sealed record UpdateExternalUpdateCutoffRequest(string? Date);

public sealed record WorkGroupDto(
    string Code,
    string Name);

public sealed record UserWorkGroupDto(
    long UserId,
    string Username,
    IReadOnlyList<string> GroupCodes);

public sealed record WorkGroupAdministrationDto(
    IReadOnlyList<WorkGroupDto> Groups,
    IReadOnlyList<UserWorkGroupDto> Users);

public sealed record CurrentUserWorkGroupsDto(
    string Username,
    IReadOnlyList<string> GroupCodes);

public sealed record UpdateUserWorkGroupsRequest(
    IReadOnlyList<string> GroupCodes);

public sealed record GestionaComplaintFieldsResponse(
    DateTime? FechaDenuncia,
    int NumeroDenunciaCanal,
    string AQuienDenuncia,
    string ResumenDenuncia,
    string FechaHechos,
    string LugarHechos,
    string AmbitoCompetencias,
    string SolicitaProteccion,
    string SexoDenunciante,
    string AutorizaRemisionDenuncia,
    string AutorizaNotificacionesViaSms,
    string PreferenciaNotificacionSeguimientoDenuncia);

public sealed record GestionaExternalFieldValue(
    string Type,
    string Value);

public sealed record GestionaExternalFieldsResponse(
    IReadOnlyDictionary<string, GestionaExternalFieldValue> Data);
