diff --git a/src/Application/Features/QualityAssurance/Commands/ArchiveCase.cs b/src/Application/Features/QualityAssurance/Commands/ArchiveCase.cs index 5daf7452..074f8832 100644 --- a/src/Application/Features/QualityAssurance/Commands/ArchiveCase.cs +++ b/src/Application/Features/QualityAssurance/Commands/ArchiveCase.cs @@ -1,4 +1,5 @@ using Cfo.Cats.Application.Common.Security; +using Cfo.Cats.Application.Common.Validators; using Cfo.Cats.Application.SecurityConstants; namespace Cfo.Cats.Application.Features.QualityAssurance.Commands; @@ -9,7 +10,8 @@ public static class ArchiveCase public class Command : IRequest { public required string ParticipantId { get; set; } - + [Description("Reason for Archive")] public ArchiveReason ArchiveReason { get; set; } = ArchiveReason.CaseloadTooHigh; + [Description("Justification for Archive")] public string? Justification { get; set; } } public class Handler(IUnitOfWork unitOfWork) : IRequestHandler @@ -17,13 +19,15 @@ public class Handler(IUnitOfWork unitOfWork) : IRequestHandler public async Task Handle(Command request, CancellationToken cancellationToken) { var participant = await unitOfWork.DbContext.Participants.FindAsync(request.ParticipantId); + participant!.Archive(request.ArchiveReason,request.Justification); participant!.TransitionTo(EnrolmentStatus.ArchivedStatus); + // ReSharper disable once MethodHasAsyncOverload return Result.Success(); } } - public class A_ParticipantMustExistValidator : AbstractValidator + public class A_ParticipantMustExistValidator : AbstractValidator { private readonly IUnitOfWork _unitOfWork; public A_ParticipantMustExistValidator(IUnitOfWork unitOfWork) @@ -41,6 +45,17 @@ public A_ParticipantMustExistValidator(IUnitOfWork unitOfWork) private async Task MustExist(string identifier, CancellationToken cancellationToken) => await _unitOfWork.DbContext.Participants.AnyAsync(e => e.Id == identifier, cancellationToken); } - - + + public class Validator : AbstractValidator + { + public Validator() + { + RuleFor(c => c.Justification) + .NotEmpty() + .When(c => c.ArchiveReason.RequiresJustification) + .WithMessage("You must provide a justification for the selected Archive reason") + .Matches(ValidationConstants.Notes) + .WithMessage(string.Format(ValidationConstants.NotesMessage, "Justification")); + } + } } diff --git a/src/Domain/Common/Enums/ArchiveReason.cs b/src/Domain/Common/Enums/ArchiveReason.cs new file mode 100644 index 00000000..7c60f79a --- /dev/null +++ b/src/Domain/Common/Enums/ArchiveReason.cs @@ -0,0 +1,26 @@ +using Ardalis.SmartEnum; + +namespace Cfo.Cats.Domain.Common.Enums; + +public sealed class ArchiveReason : SmartEnum +{ + public static readonly ArchiveReason CaseloadTooHigh = new("Caseload for this location is too high", 0, false); + public static readonly ArchiveReason Deceased = new("Deceased", 1, false); + public static readonly ArchiveReason LicenceEnd = new("Licence end date reached", 2, false); + public static readonly ArchiveReason MovedOutsideProviderArea = new("Moved outside of provider delivery catchment area", 3, false); + public static readonly ArchiveReason MovedToNonCFO = new("Moved to non-CFO location", 4, false); + public static readonly ArchiveReason NoFurtherSupport = new("No further support required", 5, false); + public static readonly ArchiveReason NoRightToLiveWork = new("No supporting right to live / work documentation", 6, false); + public static readonly ArchiveReason NoWishToParticipate = new("Participant has stated they do not wish to participate", 7, false); + public static readonly ArchiveReason NoLongerEngaging = new("Participant is no longer engaging with provision", 8, false); + public static readonly ArchiveReason PersonalCircumstances = new("Personal circumstances", 9, false); + public static readonly ArchiveReason Other = new("Other", 10, true); + + public bool RequiresJustification { get; } + + private ArchiveReason(string name, int value, bool requiresJustification) + : base(name, value) + { + RequiresJustification = requiresJustification; + } +} \ No newline at end of file diff --git a/src/Domain/Entities/Participants/Participant.cs b/src/Domain/Entities/Participants/Participant.cs index 0b0a8444..08994147 100644 --- a/src/Domain/Entities/Participants/Participant.cs +++ b/src/Domain/Entities/Participants/Participant.cs @@ -91,6 +91,13 @@ public static Participant CreateFrom( /// public string? EnrolmentLocationJustification { get; private set; } + /// + /// The justifcation for Archiving participant + /// + public string? ArchiveJustification { get; private set; } + + public ArchiveReason? ArchiveReason{ get; private set; } + public string? AssessmentJustification { get; private set; } public string? RegistrationDetailsJson { get; private set; } @@ -319,4 +326,18 @@ public Participant SetRiskDue(DateTime riskDueDate) RiskDue = riskDueDate; return this; } + + /// + /// Archives the participant + /// + /// + /// + /// + public Participant Archive(ArchiveReason archiveReason, string? justificationReason) + { + ArchiveJustification = justificationReason; + ArchiveReason = archiveReason; + + return this; + } } \ No newline at end of file diff --git a/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs b/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs index 5ffb6f58..5028534c 100644 --- a/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs +++ b/src/Infrastructure/Persistence/Configurations/Participants/ParticipantEntityTypeConfiguration.cs @@ -66,6 +66,14 @@ public void Configure(EntityTypeBuilder builder) cs => cs!.Value, cs => ConsentStatus.FromValue(cs)); + builder.Property(e => e.ArchiveReason) + .HasConversion( + ar => ar!.Value, + ar => ArchiveReason.FromValue(ar)); + + builder.Property(p => p.ArchiveJustification) + .HasMaxLength(ValidationConstants.NotesLength); + builder.HasOne(e => e.CurrentLocation) .WithMany() .HasForeignKey("_currentLocationId") diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20241101110315_Participant_AddArchiveFields.Designer.cs b/src/Migrators/Migrators.MSSQL/Migrations/20241101110315_Participant_AddArchiveFields.Designer.cs new file mode 100644 index 00000000..18ced463 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20241101110315_Participant_AddArchiveFields.Designer.cs @@ -0,0 +1,3204 @@ +// +using System; +using Cfo.Cats.Infrastructure.Persistence; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20241101110315_Participant_AddArchiveFields")] + partial class Participant_AddArchiveFields + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Contract", b => + { + b.Property("Id") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LotNumber") + .HasColumnType("int"); + + b.Property("_tenantId") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)") + .HasColumnName("TenantId"); + + b.HasKey("Id"); + + b.HasIndex("LotNumber") + .IsUnique(); + + b.HasIndex("_tenantId"); + + b.ToTable("Contract", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("_contractId") + .HasMaxLength(12) + .HasColumnType("nvarchar(12)") + .HasColumnName("ContractId"); + + b.Property("_genderProvisionId") + .HasColumnType("int") + .HasColumnName("GenderProvisionId"); + + b.Property("_locationTypeId") + .HasColumnType("int") + .HasColumnName("LocationTypeId"); + + b.Property("_parentLocationId") + .HasColumnType("int") + .HasColumnName("ParentLocationId"); + + b.HasKey("Id"); + + b.HasIndex("_contractId"); + + b.HasIndex("_parentLocationId"); + + b.ToTable("Location", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.LocationMapping", b => + { + b.Property("Code") + .HasMaxLength(3) + .HasColumnType("nvarchar(3)"); + + b.Property("CodeType") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("DeliveryRegion") + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("_locationId") + .HasColumnType("int") + .HasColumnName("LocationId"); + + b.HasKey("Code", "CodeType"); + + b.HasIndex("_locationId"); + + b.ToTable("LocationMapping", "Dms"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Tenant", b => + { + b.Property("Id") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(150) + .HasColumnType("nvarchar(150)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.ToTable("Tenant", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Assessments.ParticipantAssessment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssessmentJson") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("Assessment", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.AuditTrail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AffectedColumns") + .HasColumnType("nvarchar(max)"); + + b.Property("AuditType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("NewValues") + .HasColumnType("nvarchar(max)"); + + b.Property("OldValues") + .HasColumnType("nvarchar(max)"); + + b.Property("PrimaryKey") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TableName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AuditTrail", "Audit"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Bios.ParticipantBio", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BioJson") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("Status") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Bio", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Documents.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(4000) + .HasColumnType("nvarchar(4000)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("IsPublic") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("OwnerId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.Property("URL") + .HasColumnType("nvarchar(max)"); + + b.Property("Version") + .HasMaxLength(5) + .HasColumnType("nvarchar(5)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("LastModifiedBy"); + + b.HasIndex("TenantId"); + + b.ToTable("Document", "Document"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.IdentityAuditTrail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ActionType") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("DateTime") + .HasColumnType("datetime2"); + + b.Property("IpAddress") + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("PerformedBy") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("UserName") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("UserName", "DateTime") + .HasDatabaseName("idx_IdentityAudit_UserName_DateTime"); + + b.ToTable("IdentityAuditTrail", "Audit"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Inductions.HubInduction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(36)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("InductionDate") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false); + + b.HasIndex("CreatedBy"); + + b.HasIndex("EditorId"); + + b.HasIndex("LocationId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId", "Created"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ParticipantId", "Created")); + + b.ToTable("HubInduction", "Induction"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Inductions.WingInduction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(36)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("InductionDate") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false); + + b.HasIndex("CreatedBy"); + + b.HasIndex("EditorId"); + + b.HasIndex("LocationId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId", "Created"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ParticipantId", "Created")); + + b.ToTable("WingInduction", "Induction"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.KeyValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Text") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Value") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("KeyValue", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Notifications.Notification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasMaxLength(36) + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Details") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("Heading") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Link") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("nvarchar(36)"); + + b.Property("ReadDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + SqlServerKeyBuilderExtensions.IsClustered(b.HasKey("Id"), false); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId", "Created", "ReadDate"); + + b.HasIndex(new[] { "Created" }, "clst_notification"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex(new[] { "Created" }, "clst_notification")); + + b.ToTable("Notification", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.ParticipantAccessAuditTrail", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AccessDate") + .HasColumnType("datetime2"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("RequestType") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("AccessAuditTrail", "Audit"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentEscalationQueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("EscalationQueue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentPqaQueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("PqaQueue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa1QueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("Qa1Queue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa2QueueEntry", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("EditorId") + .HasColumnType("nvarchar(36)"); + + b.Property("IsAccepted") + .HasColumnType("bit"); + + b.Property("IsCompleted") + .HasColumnType("bit"); + + b.Property("IsEscalated") + .HasColumnType("bit"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b.Property("OwnerId") + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("Qa2Queue", "Enrolment"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.Property("Id") + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.Property("ActiveInFeed") + .HasColumnType("bit"); + + b.Property("ArchiveJustification") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ArchiveReason") + .HasColumnType("int"); + + b.Property("AssessmentJustification") + .HasColumnType("nvarchar(max)"); + + b.Property("ConsentStatus") + .HasColumnType("int"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DateOfBirth") + .HasColumnType("date"); + + b.Property("EditorId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("EnrolmentLocationJustification") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("EnrolmentStatus") + .HasColumnType("int"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Gender") + .HasMaxLength(6) + .HasColumnType("nvarchar(6)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MiddleName") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Nationality") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("OwnerId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ReferralComments") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ReferralSource") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("RegistrationDetailsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("RiskDue") + .HasColumnType("datetime2"); + + b.Property("_currentLocationId") + .HasColumnType("int") + .HasColumnName("CurrentLocationId"); + + b.Property("_enrolmentLocationId") + .HasColumnType("int") + .HasColumnName("EnrolmentLocationId"); + + b.HasKey("Id"); + + b.HasIndex("EditorId"); + + b.HasIndex("OwnerId"); + + b.HasIndex("_currentLocationId"); + + b.HasIndex("_enrolmentLocationId"); + + b.ToTable("Participant", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.ParticipantEnrolmentHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("EnrolmentStatus") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("EnrolmentHistory", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.ParticipantLocationHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("From") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + b.HasIndex("LocationId"); + + b.HasIndex("ParticipantId"); + + b.ToTable("LocationHistory", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.ParticipantOwnershipHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("From") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("OwnerId") + .IsRequired() + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(50)"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.HasIndex("ParticipantId"); + + b.HasIndex("TenantId"); + + b.ToTable("OwnershipHistory", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.PathwayPlan", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ParticipantId") + .IsRequired() + .HasMaxLength(9) + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("PathwayPlan", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Risk", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ActivityRecommendations") + .HasColumnType("nvarchar(max)"); + + b.Property("ActivityRecommendationsReceived") + .HasColumnType("datetime2"); + + b.Property("ActivityRestrictions") + .HasColumnType("nvarchar(max)"); + + b.Property("ActivityRestrictionsReceived") + .HasColumnType("datetime2"); + + b.Property("AdditionalInformation") + .HasColumnType("nvarchar(max)"); + + b.Property("Completed") + .HasColumnType("datetime2"); + + b.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("IsRelevantToCommunity") + .HasColumnType("bit"); + + b.Property("IsRelevantToCustody") + .HasColumnType("bit"); + + b.Property("IsSubjectToSHPO") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LicenseConditions") + .HasColumnType("nvarchar(max)"); + + b.Property("LicenseEnd") + .HasColumnType("datetime2"); + + b.Property("NSDCase") + .HasColumnType("int"); + + b.Property("PSFRestrictions") + .HasColumnType("nvarchar(max)"); + + b.Property("PSFRestrictionsReceived") + .HasColumnType("datetime2"); + + b.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b.Property("ReferredOn") + .HasColumnType("datetime2"); + + b.Property("ReferrerEmail") + .HasColumnType("nvarchar(max)"); + + b.Property("ReferrerName") + .HasColumnType("nvarchar(max)"); + + b.Property("RegistrationDetailsJson") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewJustification") + .HasColumnType("nvarchar(max)"); + + b.Property("ReviewReason") + .HasColumnType("int"); + + b.Property("RiskToChildrenInCommunity") + .HasColumnType("int"); + + b.Property("RiskToChildrenInCustody") + .HasColumnType("int"); + + b.Property("RiskToKnownAdultInCommunity") + .HasColumnType("int"); + + b.Property("RiskToKnownAdultInCustody") + .HasColumnType("int"); + + b.Property("RiskToOtherPrisonersInCustody") + .HasColumnType("int"); + + b.Property("RiskToPublicInCommunity") + .HasColumnType("int"); + + b.Property("RiskToPublicInCustody") + .HasColumnType("int"); + + b.Property("RiskToSelfInCommunity") + .HasColumnType("int"); + + b.Property("RiskToSelfInCustody") + .HasColumnType("int"); + + b.Property("RiskToStaffInCommunity") + .HasColumnType("int"); + + b.Property("RiskToStaffInCustody") + .HasColumnType("int"); + + b.Property("SpecificRisk") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Risk", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Timeline", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .HasColumnType("nvarchar(36)"); + + b.Property("EventType") + .HasColumnType("int"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Line1") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Line2") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Line3") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedBy"); + + b.HasIndex("ParticipantId"); + + b.ToTable("Timeline", "Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRole", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NormalizedName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RoleRank") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Role", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Group") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RoleId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaim", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUser", b => + { + b.Property("Id") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("AccessFailedCount") + .HasColumnType("int"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("DisplayName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("bit"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("IsLive") + .HasColumnType("bit"); + + b.Property("LastLogin") + .HasColumnType("datetime2"); + + b.Property("LastModified") + .HasColumnType("datetime2"); + + b.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LockoutEnabled") + .HasColumnType("bit"); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("MemorableDate") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("MemorablePlace") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("PhoneNumber") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("bit"); + + b.Property("ProfilePictureDataUrl") + .HasColumnType("text"); + + b.Property("ProviderId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("RefreshToken") + .HasColumnType("nvarchar(max)"); + + b.Property("RefreshTokenExpiryTime") + .HasColumnType("datetime2"); + + b.Property("RequiresPasswordReset") + .HasColumnType("bit"); + + b.Property("SecurityStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("SuperiorId") + .HasColumnType("nvarchar(36)"); + + b.Property("TenantId") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TenantName") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("TwoFactorEnabled") + .HasColumnType("bit"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex") + .HasFilter("[NormalizedUserName] IS NOT NULL"); + + b.HasIndex("SuperiorId"); + + b.HasIndex("TenantId"); + + b.ToTable("User", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("nvarchar(max)"); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserClaim", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserRole", b => + { + b.Property("UserId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("RoleId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRole", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserToken", b => + { + b.Property("UserId") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("UserToken", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.PasswordHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("Id"); + + b.ToTable("PasswordHistory", "Identity"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.UserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(450)"); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("UserLogin", "Identity"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("FriendlyName") + .HasColumnType("nvarchar(max)"); + + b.Property("Xml") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("DataProtectionKeys"); + }); + + modelBuilder.Entity("TenantLocation", b => + { + b.Property("LocationId") + .HasColumnType("int"); + + b.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b.HasKey("LocationId", "TenantId"); + + b.HasIndex("TenantId"); + + b.ToTable("TenantLocation", "Configuration"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Contract", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("_tenantId"); + + b.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b1 => + { + b1.Property("ContractId") + .HasColumnType("nvarchar(12)"); + + b1.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeEnd"); + + b1.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeStart"); + + b1.HasKey("ContractId"); + + b1.ToTable("Contract", "Configuration"); + + b1.WithOwner() + .HasForeignKey("ContractId"); + }); + + b.Navigation("Lifetime") + .IsRequired(); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Location", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Contract", "Contract") + .WithMany("Locations") + .HasForeignKey("_contractId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "ParentLocation") + .WithMany("ChildLocations") + .HasForeignKey("_parentLocationId") + .OnDelete(DeleteBehavior.Restrict); + + b.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b1 => + { + b1.Property("LocationId") + .HasColumnType("int"); + + b1.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeEnd"); + + b1.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("LifetimeStart"); + + b1.HasKey("LocationId"); + + b1.ToTable("Location", "Configuration"); + + b1.WithOwner() + .HasForeignKey("LocationId"); + }); + + b.Navigation("Contract"); + + b.Navigation("Lifetime") + .IsRequired(); + + b.Navigation("ParentLocation"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.LocationMapping", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "Location") + .WithMany("LocationMappings") + .HasForeignKey("_locationId"); + + b.Navigation("Location"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Tenant", b => + { + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.TenantDomain", "Domains", b1 => + { + b1.Property("TenantId") + .HasColumnType("nvarchar(50)"); + + b1.Property("Domain") + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.HasKey("TenantId", "Domain"); + + b1.ToTable("TenantDomain", "Configuration"); + + b1.WithOwner() + .HasForeignKey("TenantId"); + }); + + b.Navigation("Domains"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Assessments.ParticipantAssessment", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.PathwayScore", "Scores", b1 => + { + b1.Property("AssessmentId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Pathway") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b1.Property("Score") + .HasColumnType("float"); + + b1.HasKey("AssessmentId", "Pathway"); + + b1.ToTable("AssessmentPathwayScore", "Participant"); + + b1.WithOwner() + .HasForeignKey("AssessmentId"); + }); + + b.Navigation("Editor"); + + b.Navigation("Owner"); + + b.Navigation("Scores"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.AuditTrail", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.SetNull); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Bios.ParticipantBio", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Documents.Document", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("CreatedBy") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("LastModifiedBy") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId"); + + b.Navigation("Editor"); + + b.Navigation("Owner"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Inductions.HubInduction", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", null) + .WithMany() + .HasForeignKey("CreatedBy") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Editor"); + + b.Navigation("Location"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Inductions.WingInduction", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", null) + .WithMany() + .HasForeignKey("CreatedBy") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "Location") + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Inductions.InductionPhase", "Phases", b1 => + { + b1.Property("WingInductionId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Number") + .HasColumnType("int"); + + b1.Property("CompletedDate") + .HasColumnType("datetime2"); + + b1.Property("StartDate") + .HasColumnType("datetime2"); + + b1.HasKey("WingInductionId", "Number"); + + b1.ToTable("WingInductionPhase", "Induction"); + + b1.WithOwner() + .HasForeignKey("WingInductionId"); + }); + + b.Navigation("Editor"); + + b.Navigation("Location"); + + b.Navigation("Owner"); + + b.Navigation("Phases"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Notifications.Notification", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Editor"); + + b.Navigation("Owner"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.ParticipantAccessAuditTrail", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentEscalationQueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.EnrolmentQueueEntryNote", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentEscalationQueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("IsExternal") + .HasColumnType("bit"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentEscalationQueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("EscalationNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentEscalationQueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentPqaQueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.EnrolmentQueueEntryNote", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentPqaQueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentPqaQueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("PqaQueueNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentPqaQueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa1QueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.EnrolmentQueueEntryNote", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentQa1QueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("IsExternal") + .HasColumnType("bit"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentQa1QueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("Qa1QueueNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentQa1QueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.EnrolmentQa2QueueEntry", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.EnrolmentQueueEntryNote", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("EnrolmentQa2QueueEntryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("IsExternal") + .HasColumnType("bit"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("EnrolmentQa2QueueEntryId"); + + b1.HasIndex("LastModifiedBy"); + + b1.ToTable("Qa2QueueNote", "Enrolment"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.WithOwner() + .HasForeignKey("EnrolmentQa2QueueEntryId"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Editor"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("Participant"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Participant", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Editor") + .WithMany() + .HasForeignKey("EditorId"); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "CurrentLocation") + .WithMany() + .HasForeignKey("_currentLocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_Participant_Location"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", "EnrolmentLocation") + .WithMany() + .HasForeignKey("_enrolmentLocationId") + .HasConstraintName("FK_Participant_EnrolmentLocation"); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.Consent", "Consents", b1 => + { + b1.Property("ParticipantId") + .HasColumnType("nvarchar(9)"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("_documentId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DocumentId"); + + b1.HasKey("ParticipantId", "Id"); + + b1.HasIndex("_documentId"); + + b1.ToTable("Consent", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + + b1.HasOne("Cfo.Cats.Domain.Entities.Documents.Document", "Document") + .WithMany() + .HasForeignKey("_documentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b1.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b2 => + { + b2.Property("ConsentParticipantId") + .HasColumnType("nvarchar(9)"); + + b2.Property("ConsentId") + .HasColumnType("int"); + + b2.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("ValidTo"); + + b2.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("ValidFrom"); + + b2.HasKey("ConsentParticipantId", "ConsentId"); + + b2.ToTable("Consent", "Participant"); + + b2.WithOwner() + .HasForeignKey("ConsentParticipantId", "ConsentId"); + }); + + b1.Navigation("Document"); + + b1.Navigation("Lifetime") + .IsRequired(); + }); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ExternalIdentifier", "ExternalIdentifiers", b1 => + { + b1.Property("Value") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b1.Property("Type") + .HasColumnType("int"); + + b1.Property("ParticipantId") + .HasColumnType("nvarchar(9)"); + + b1.HasKey("Value", "Type", "ParticipantId"); + + b1.HasIndex("ParticipantId"); + + b1.ToTable("ExternalIdentifier", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + }); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b1.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("LastModifiedBy"); + + b1.HasIndex("ParticipantId"); + + b1.ToTable("Note", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.RightToWork", "RightToWorks", b1 => + { + b1.Property("ParticipantId") + .HasColumnType("nvarchar(9)"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("_documentId") + .HasColumnType("uniqueidentifier") + .HasColumnName("DocumentId"); + + b1.HasKey("ParticipantId", "Id"); + + b1.HasIndex("_documentId"); + + b1.ToTable("RightToWork", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + + b1.HasOne("Cfo.Cats.Domain.Entities.Documents.Document", "Document") + .WithMany() + .HasForeignKey("_documentId"); + + b1.OwnsOne("Cfo.Cats.Domain.ValueObjects.Lifetime", "Lifetime", b2 => + { + b2.Property("RightToWorkParticipantId") + .HasColumnType("nvarchar(9)"); + + b2.Property("RightToWorkId") + .HasColumnType("int"); + + b2.Property("EndDate") + .HasColumnType("datetime2") + .HasColumnName("ValidTo"); + + b2.Property("StartDate") + .HasColumnType("datetime2") + .HasColumnName("ValidFrom"); + + b2.HasKey("RightToWorkParticipantId", "RightToWorkId"); + + b2.ToTable("RightToWork", "Participant"); + + b2.WithOwner() + .HasForeignKey("RightToWorkParticipantId", "RightToWorkId"); + }); + + b1.Navigation("Document"); + + b1.Navigation("Lifetime") + .IsRequired(); + }); + + b.OwnsOne("Cfo.Cats.Domain.Entities.Participants.Supervisor", "Supervisor", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Address") + .HasMaxLength(256) + .HasColumnType("nvarchar(256)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasColumnType("nvarchar(max)"); + + b1.Property("EmailAddress") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasColumnType("nvarchar(max)"); + + b1.Property("MobileNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b1.Property("Name") + .HasMaxLength(128) + .HasColumnType("nvarchar(128)"); + + b1.Property("ParticipantId") + .IsRequired() + .HasColumnType("nvarchar(9)"); + + b1.Property("TelephoneNumber") + .HasMaxLength(16) + .HasColumnType("nvarchar(16)"); + + b1.HasKey("Id"); + + b1.HasIndex("ParticipantId") + .IsUnique(); + + b1.ToTable("Supervisor", "Participant"); + + b1.WithOwner() + .HasForeignKey("ParticipantId"); + }); + + b.Navigation("Consents"); + + b.Navigation("CurrentLocation"); + + b.Navigation("Editor"); + + b.Navigation("EnrolmentLocation"); + + b.Navigation("ExternalIdentifiers"); + + b.Navigation("Notes"); + + b.Navigation("Owner"); + + b.Navigation("RightToWorks"); + + b.Navigation("Supervisor"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.ParticipantLocationHistory", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", null) + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.ParticipantOwnershipHistory", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", null) + .WithMany() + .HasForeignKey("OwnerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.PathwayPlan", b => + { + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.Objective", "Objectives", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Completed") + .HasColumnType("datetime2"); + + b1.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("CompletedStatus") + .HasColumnType("int"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.Property("Index") + .HasColumnType("int"); + + b1.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("PathwayPlanId") + .HasColumnType("uniqueidentifier"); + + b1.HasKey("Id"); + + b1.HasIndex("CompletedBy"); + + b1.HasIndex("PathwayPlanId"); + + b1.ToTable("Objective", "Participant"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b1.WithOwner() + .HasForeignKey("PathwayPlanId"); + + b1.OwnsMany("Cfo.Cats.Domain.Entities.Participants.ObjectiveTask", "Tasks", b2 => + { + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b2.Property("Completed") + .HasColumnType("datetime2"); + + b2.Property("CompletedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b2.Property("CompletedStatus") + .HasColumnType("int"); + + b2.Property("Created") + .HasColumnType("datetime2"); + + b2.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b2.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b2.Property("Due") + .HasColumnType("datetime2"); + + b2.Property("Index") + .HasColumnType("int"); + + b2.Property("Justification") + .HasColumnType("nvarchar(max)"); + + b2.Property("LastModified") + .HasColumnType("datetime2"); + + b2.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b2.Property("ObjectiveId") + .HasColumnType("uniqueidentifier"); + + b2.HasKey("Id"); + + b2.HasIndex("CompletedBy"); + + b2.HasIndex("ObjectiveId"); + + b2.ToTable("ObjectiveTask", "Participant"); + + b2.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CompletedByUser") + .WithMany() + .HasForeignKey("CompletedBy"); + + b2.WithOwner() + .HasForeignKey("ObjectiveId"); + + b2.Navigation("CompletedByUser"); + }); + + b1.Navigation("CompletedByUser"); + + b1.Navigation("Tasks"); + }); + + b.OwnsMany("Cfo.Cats.Domain.Entities.Participants.PathwayPlanReviewHistory", "ReviewHistories", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("PathwayPlanId") + .HasColumnType("uniqueidentifier"); + + b1.HasKey("Id"); + + b1.HasIndex("PathwayPlanId"); + + b1.ToTable("PathwayPlanReviewHistory", "Participant"); + + b1.WithOwner() + .HasForeignKey("PathwayPlanId"); + }); + + b.Navigation("Objectives"); + + b.Navigation("ReviewHistories"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Risk", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", "Participant") + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Participant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Participants.Timeline", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Cfo.Cats.Domain.Entities.Participants.Participant", null) + .WithMany() + .HasForeignKey("ParticipantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedByUser"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRoleClaim", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationRole", "Role") + .WithMany("RoleClaims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUser", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "Superior") + .WithMany() + .HasForeignKey("SuperiorId"); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", "Tenant") + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Cfo.Cats.Domain.ValueObjects.Note", "Notes", b1 => + { + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b1.Property("Id")); + + b1.Property("CallReference") + .HasMaxLength(20) + .HasColumnType("nvarchar(20)"); + + b1.Property("Created") + .HasColumnType("datetime2"); + + b1.Property("CreatedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("LastModified") + .HasColumnType("datetime2"); + + b1.Property("LastModifiedBy") + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.Property("Message") + .IsRequired() + .HasMaxLength(255) + .HasColumnType("nvarchar(255)"); + + b1.Property("TenantId") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.Property("UserId") + .IsRequired() + .HasMaxLength(36) + .HasColumnType("nvarchar(36)"); + + b1.HasKey("Id"); + + b1.HasIndex("CreatedBy"); + + b1.HasIndex("LastModifiedBy"); + + b1.HasIndex("UserId"); + + b1.ToTable("Note", "Identity"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "CreatedByUser") + .WithMany() + .HasForeignKey("CreatedBy"); + + b1.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "LastModifiedByUser") + .WithMany() + .HasForeignKey("LastModifiedBy"); + + b1.WithOwner() + .HasForeignKey("UserId"); + + b1.Navigation("CreatedByUser"); + + b1.Navigation("LastModifiedByUser"); + }); + + b.Navigation("Notes"); + + b.Navigation("Superior"); + + b.Navigation("Tenant"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserClaim", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("UserClaims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserRole", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationRole", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUserToken", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.UserLogin", b => + { + b.HasOne("Cfo.Cats.Domain.Identity.ApplicationUser", "User") + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("TenantLocation", b => + { + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Location", null) + .WithMany() + .HasForeignKey("LocationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Cfo.Cats.Domain.Entities.Administration.Tenant", null) + .WithMany() + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Contract", b => + { + b.Navigation("Locations"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Entities.Administration.Location", b => + { + b.Navigation("ChildLocations"); + + b.Navigation("LocationMappings"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationRole", b => + { + b.Navigation("RoleClaims"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("Cfo.Cats.Domain.Identity.ApplicationUser", b => + { + b.Navigation("Logins"); + + b.Navigation("Tokens"); + + b.Navigation("UserClaims"); + + b.Navigation("UserRoles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/20241101110315_Participant_AddArchiveFields.cs b/src/Migrators/Migrators.MSSQL/Migrations/20241101110315_Participant_AddArchiveFields.cs new file mode 100644 index 00000000..325c5737 --- /dev/null +++ b/src/Migrators/Migrators.MSSQL/Migrations/20241101110315_Participant_AddArchiveFields.cs @@ -0,0 +1,43 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Cfo.Cats.Migrators.MSSQL.Migrations +{ + /// + public partial class Participant_AddArchiveFields : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "ArchiveJustification", + schema: "Participant", + table: "Participant", + type: "nvarchar(1000)", + maxLength: 1000, + nullable: true); + + migrationBuilder.AddColumn( + name: "ArchiveReason", + schema: "Participant", + table: "Participant", + type: "int", + nullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "ArchiveJustification", + schema: "Participant", + table: "Participant"); + + migrationBuilder.DropColumn( + name: "ArchiveReason", + schema: "Participant", + table: "Participant"); + } + } +} diff --git a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs index f32df0af..88f30748 100644 --- a/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs +++ b/src/Migrators/Migrators.MSSQL/Migrations/ApplicationDbContextModelSnapshot.cs @@ -908,6 +908,13 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("ActiveInFeed") .HasColumnType("bit"); + b.Property("ArchiveJustification") + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("ArchiveReason") + .HasColumnType("int"); + b.Property("AssessmentJustification") .HasColumnType("nvarchar(max)"); diff --git a/src/Server.UI/Pages/Participants/Components/ArchiveCaseDialog.razor b/src/Server.UI/Pages/Participants/Components/ArchiveCaseDialog.razor new file mode 100644 index 00000000..c6d6bbd4 --- /dev/null +++ b/src/Server.UI/Pages/Participants/Components/ArchiveCaseDialog.razor @@ -0,0 +1,76 @@ +@using Cfo.Cats.Application.Features.QualityAssurance.Commands +@using Cfo.Cats.Domain.Common.Enums + +@inject IValidationService Validator + + + + + + @ArchiveReason.CaseloadTooHigh.Name + @ArchiveReason.Deceased.Name + @ArchiveReason.LicenceEnd.Name + @ArchiveReason.MovedOutsideProviderArea.Name + @ArchiveReason.MovedToNonCFO.Name + @ArchiveReason.NoFurtherSupport.Name + @ArchiveReason.NoRightToLiveWork.Name + @ArchiveReason.NoWishToParticipate.Name + @ArchiveReason.NoLongerEngaging.Name + @ArchiveReason.PersonalCircumstances.Name + @ArchiveReason.Other.Name + + + + + + + @ConstantString.Cancel + @ConstantString.Archive + + + +@code { + bool saving = false; + MudForm? form; + + [CascadingParameter] private MudDialogInstance MudDialog { get; set; } = default!; + + [Parameter, EditorRequired] + public required ArchiveCase.Command Model { get; set; } + + private void Cancel() + { + MudDialog.Cancel(); + } + + private async Task Submit() + { + try + { + saving = true; + + if(form is null) + { + saving = false; + return; + } + + await form.Validate(); + + if(form.IsValid) + { + MudDialog.Close(DialogResult.Ok(true)); + } + } + finally + { + saving = false; + } + } +} \ No newline at end of file diff --git a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor index 53def5e0..ba040fff 100644 --- a/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor +++ b/src/Server.UI/Pages/Participants/Components/ParticipantActionMenu.razor @@ -44,8 +44,6 @@ } - - @@ -60,7 +58,6 @@ [CascadingParameter] public UserProfile UserProfile { get; set; } = default!; - protected override async Task OnInitializedAsync() { var state = await AuthState; @@ -71,21 +68,23 @@ protected async Task Archive() { - var parameters = new DialogParameters() - { - { x => x.ContentText, "Are you sure you would like to archive this case?" } - }; - - var dialog = await DialogService.ShowAsync("Archive", parameters); - var dialogResult = await dialog.Result; + var command = new ArchiveCase.Command() + { + ParticipantId = Participant.Id + }; - if (dialogResult?.Canceled is not true) - { - var command = new ArchiveCase.Command() + var parameters = new DialogParameters() { - ParticipantId = Participant.Id + { x => x.Model,command} }; + var options = new DialogOptions { CloseButton = true, MaxWidth = MaxWidth.Small, FullWidth = true }; + var dialog = DialogService.Show("Archive Case", parameters, options); + + var state = await dialog.Result; + + if (state!.Canceled is false) + { var result = await GetNewMediator().Send(command); if (result.Succeeded) @@ -96,9 +95,7 @@ { ShowActionFailure("Failed to archive", result); } - - } - + } } protected async Task Suspend() @@ -114,9 +111,9 @@ if (dialogResult?.Canceled is not true) { var command = new SuspendCase.Command() - { - ParticipantId = Participant.Id - }; + { + ParticipantId = Participant.Id + }; var result = await GetNewMediator().Send(command); if (result.Succeeded) @@ -127,9 +124,7 @@ { ShowActionFailure("Failed to suspend", result); } - } - } protected async Task SubmitToPqa() @@ -170,7 +165,6 @@ await SubmitToPqa(); } } - } protected async Task OpenRightToWorkDialog() @@ -192,12 +186,10 @@ { dialog.Close(); } - } protected async Task OpenAdjustLocationDialog() { - var parameters = new DialogParameters() { { x => x.UserProfile, this.UserProfile }, @@ -235,8 +227,8 @@ { dialog.Close(); } - } + private void ShowActionFailure(string title, IResult result) { Snackbar.Add( @@ -254,5 +246,4 @@ options.SnackbarVariant = Variant.Text; } ); } - }