#nullable enable
using Baya.Application.Models.Patients;

namespace Baya.Application.Models.Reviews;

/// <summary>A patient-care-record row as it leaves the repository — the clinical body is still <b>ciphertext</b>
/// here; the handler decrypts it only after the strict clinical access check passes, then maps to
/// <see cref="CareRecordDto"/>. Keeping the cipher in the projection means no query path can surface plaintext.</summary>
public record CareRecordCipherRow(
    long Id,
    long PatientId,
    long? BookingId,
    long NurseProfileId,
    string? NurseName,
    string BodyEncrypted,
    string? TaskResultsJson,
    DateTime RecordedAt);

/// <summary>A decrypted clinical note returned to an authorized reader (owning customer / nurse with a
/// confirmed booking / admin). Newest first. <see cref="TaskResults"/> is the visit's ticked checklist.</summary>
public record CareRecordDto(
    long Id,
    long PatientId,
    long? BookingId,
    long NurseProfileId,
    string? NurseName,
    string Body,
    IReadOnlyList<TaskResultDto> TaskResults,
    DateTime RecordedAt);

/// <summary>What <c>WritePatientCareRecordCommand</c> returns.</summary>
public record WriteCareRecordResult(long Id, long PatientId, DateTime RecordedAt);
