diff --git a/backend/api/Controllers/BlobStorageController.cs b/backend/api/Controllers/BlobStorageController.cs index ed7b7d7e1..5dd6d6072 100644 --- a/backend/api/Controllers/BlobStorageController.cs +++ b/backend/api/Controllers/BlobStorageController.cs @@ -5,7 +5,7 @@ [Authorize] [ApiController] -[Route("projects/{projectId}/cases/{caseId}/images")] +[Route("projects/{projectId}")] public class BlobStorageController : ControllerBase { private readonly IBlobStorageService _blobStorageService; @@ -15,8 +15,7 @@ public BlobStorageController(IBlobStorageService blobStorageService) _blobStorageService = blobStorageService; } - [HttpPost] - public async Task> UploadImage(Guid projectId, [FromForm] string projectName, Guid caseId, [FromForm] IFormFile image) + private async Task> UploadImage(Guid projectId, string projectName, Guid? caseId, IFormFile image) { const int maxFileSize = 5 * 1024 * 1024; // 5MB string[] permittedExtensions = { ".jpg", ".jpeg", ".png", ".gif" }; @@ -37,12 +36,32 @@ public async Task> UploadImage(Guid projectId, [FromForm] return BadRequest($"File {image.FileName} has an invalid extension. Only image files are allowed."); } - // Process the image upload - var imageDto = await _blobStorageService.SaveImage(projectId, projectName, image, caseId); - return Ok(imageDto); + try + { + if (caseId.HasValue) + { + var imageDto = await _blobStorageService.SaveImage(projectId, projectName, image, caseId.Value); + return Ok(imageDto); + } + else + { + var imageDto = await _blobStorageService.SaveImage(projectId, projectName, image); + return Ok(imageDto); + } + } + catch (Exception) + { + return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while uploading the image."); + } + } + + [HttpPost("cases/{caseId}/images")] + public Task> UploadCaseImage(Guid projectId, [FromForm] string projectName, Guid caseId, [FromForm] IFormFile image) + { + return UploadImage(projectId, projectName, caseId, image); } - [HttpGet] + [HttpGet("cases/{caseId}/images")] public async Task>> GetImages(Guid projectId, Guid caseId) { try @@ -56,12 +75,12 @@ public async Task>> GetImages(Guid projectId, Guid c } } - [HttpDelete("{imageId}")] - public async Task DeleteImage(Guid projectId, Guid caseId, Guid imageId) + [HttpDelete("cases/{caseId}/images/{imageId}")] + public async Task DeleteCaseImage(Guid imageId) { try { - await _blobStorageService.DeleteImage(caseId, imageId); + await _blobStorageService.DeleteImage(imageId); return NoContent(); } catch (Exception) @@ -70,4 +89,37 @@ public async Task DeleteImage(Guid projectId, Guid caseId, Guid im } } + [HttpPost("images")] + public Task> UploadProjectImage(Guid projectId, [FromForm] string projectName, [FromForm] IFormFile image) + { + return UploadImage(projectId, projectName, null, image); + } + + [HttpGet("images")] + public async Task>> GetProjectImages(Guid projectId) + { + try + { + var imageDtos = await _blobStorageService.GetProjectImages(projectId); + return Ok(imageDtos); + } + catch (Exception) + { + return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while retrieving images."); + } + } + + [HttpDelete("images/{imageId}")] + public async Task DeleteProjectImage(Guid imageId) + { + try + { + await _blobStorageService.DeleteImage(imageId); + return NoContent(); + } + catch (Exception) + { + return StatusCode(StatusCodes.Status500InternalServerError, "An error occurred while deleting the image."); + } + } } diff --git a/backend/api/Dtos/Image/imageDto.cs b/backend/api/Dtos/Image/imageDto.cs index 4e3e3c71a..c867c8fb6 100644 --- a/backend/api/Dtos/Image/imageDto.cs +++ b/backend/api/Dtos/Image/imageDto.cs @@ -18,7 +18,7 @@ public class ImageDto public string? Description { get; set; } [Required] - public Guid CaseId { get; set; } + public Guid? CaseId { get; set; } [Required] public string ProjectName { get; set; } = null!; diff --git a/backend/api/Migrations/20240709120742_projectImageUpload.Designer.cs b/backend/api/Migrations/20240709120742_projectImageUpload.Designer.cs new file mode 100644 index 000000000..e7d04342a --- /dev/null +++ b/backend/api/Migrations/20240709120742_projectImageUpload.Designer.cs @@ -0,0 +1,3597 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using api.Context; + +#nullable disable + +namespace api.Migrations +{ + [DbContext(typeof(DcdDbContext))] + [Migration("20240709120742_projectImageUpload")] + partial class projectImageUpload + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("api.Models.AdditionalOPEXCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("AdditionalOPEXCostProfile"); + }); + + modelBuilder.Entity("api.Models.AppraisalWellCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Exploration.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Exploration.Id") + .IsUnique(); + + b.ToTable("AppraisalWellCostProfile"); + }); + + modelBuilder.Entity("api.Models.Case", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("APXDate") + .HasColumnType("datetimeoffset"); + + b.Property("APZDate") + .HasColumnType("datetimeoffset"); + + b.Property("ArtificialLift") + .HasColumnType("int"); + + b.Property("BreakEven") + .HasColumnType("float"); + + b.Property("CapexFactorFEEDStudies") + .HasColumnType("float"); + + b.Property("CapexFactorFeasibilityStudies") + .HasColumnType("float"); + + b.Property("CreateTime") + .HasColumnType("datetimeoffset"); + + b.Property("DG0Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG1Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG2Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG3Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG4Date") + .HasColumnType("datetimeoffset"); + + b.Property("DGADate") + .HasColumnType("datetimeoffset"); + + b.Property("DGBDate") + .HasColumnType("datetimeoffset"); + + b.Property("DGCDate") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DrainageStrategyLink") + .HasColumnType("uniqueidentifier"); + + b.Property("ExplorationLink") + .HasColumnType("uniqueidentifier"); + + b.Property("FacilitiesAvailability") + .HasColumnType("float"); + + b.Property("GasInjectorCount") + .HasColumnType("int"); + + b.Property("Host") + .HasColumnType("nvarchar(max)"); + + b.Property("ModifyTime") + .HasColumnType("datetimeoffset"); + + b.Property("NPV") + .HasColumnType("float"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerCount") + .HasColumnType("int"); + + b.Property("ProductionStrategyOverview") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("ReferenceCase") + .HasColumnType("bit"); + + b.Property("SharepointFileId") + .HasColumnType("nvarchar(max)"); + + b.Property("SharepointFileName") + .HasColumnType("nvarchar(max)"); + + b.Property("SharepointFileUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("SubstructureLink") + .HasColumnType("uniqueidentifier"); + + b.Property("SurfLink") + .HasColumnType("uniqueidentifier"); + + b.Property("TopsideLink") + .HasColumnType("uniqueidentifier"); + + b.Property("TransportLink") + .HasColumnType("uniqueidentifier"); + + b.Property("WaterInjectorCount") + .HasColumnType("int"); + + b.Property("WellProjectLink") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Cases"); + }); + + modelBuilder.Entity("api.Models.CessationOffshoreFacilitiesCost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("CessationOffshoreFacilitiesCost"); + }); + + modelBuilder.Entity("api.Models.CessationOffshoreFacilitiesCostOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("CessationOffshoreFacilitiesCostOverride"); + }); + + modelBuilder.Entity("api.Models.CessationOnshoreFacilitiesCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("CessationOnshoreFacilitiesCostProfile"); + }); + + modelBuilder.Entity("api.Models.CessationWellsCost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("CessationWellsCost"); + }); + + modelBuilder.Entity("api.Models.CessationWellsCostOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("CessationWellsCostOverride"); + }); + + modelBuilder.Entity("api.Models.Co2Emissions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("Co2Emissions"); + }); + + modelBuilder.Entity("api.Models.Co2EmissionsOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("Co2EmissionsOverride"); + }); + + modelBuilder.Entity("api.Models.CountryOfficeCost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Exploration.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Exploration.Id") + .IsUnique(); + + b.ToTable("CountryOfficeCost"); + }); + + modelBuilder.Entity("api.Models.DeferredGasProduction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("DeferredGasProduction"); + }); + + modelBuilder.Entity("api.Models.DeferredOilProduction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("DeferredOilProduction"); + }); + + modelBuilder.Entity("api.Models.DevelopmentOperationalWellCosts", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AnnualWellInterventionCostPerWell") + .HasColumnType("float"); + + b.Property("PluggingAndAbandonment") + .HasColumnType("float"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("RigMobDemob") + .HasColumnType("float"); + + b.Property("RigUpgrading") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId") + .IsUnique(); + + b.ToTable("DevelopmentOperationalWellCosts"); + }); + + modelBuilder.Entity("api.Models.DrainageStrategy", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtificialLift") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GasInjectorCount") + .HasColumnType("int"); + + b.Property("GasSolution") + .HasColumnType("int"); + + b.Property("NGLYield") + .HasColumnType("float"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerCount") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("WaterInjectorCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("DrainageStrategies"); + }); + + modelBuilder.Entity("api.Models.DrillingSchedule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("DrillingSchedule"); + }); + + modelBuilder.Entity("api.Models.Exploration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("RigMobDemob") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Explorations"); + }); + + modelBuilder.Entity("api.Models.ExplorationOperationalWellCosts", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AppraisalProjectDrillingCosts") + .HasColumnType("float"); + + b.Property("AppraisalRigMobDemob") + .HasColumnType("float"); + + b.Property("ExplorationProjectDrillingCosts") + .HasColumnType("float"); + + b.Property("ExplorationRigMobDemob") + .HasColumnType("float"); + + b.Property("ExplorationRigUpgrading") + .HasColumnType("float"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId") + .IsUnique(); + + b.ToTable("ExplorationOperationalWellCosts"); + }); + + modelBuilder.Entity("api.Models.ExplorationWell", b => + { + b.Property("ExplorationId") + .HasColumnType("uniqueidentifier"); + + b.Property("WellId") + .HasColumnType("uniqueidentifier"); + + b.Property("DrillingScheduleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("ExplorationId", "WellId"); + + b.HasIndex("DrillingScheduleId"); + + b.HasIndex("WellId"); + + b.ToTable("ExplorationWell"); + }); + + modelBuilder.Entity("api.Models.ExplorationWellCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Exploration.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Exploration.Id") + .IsUnique(); + + b.ToTable("ExplorationWellCostProfile"); + }); + + modelBuilder.Entity("api.Models.FuelFlaringAndLosses", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("FuelFlaringAndLosses"); + }); + + modelBuilder.Entity("api.Models.FuelFlaringAndLossesOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("FuelFlaringAndLossesOverride"); + }); + + modelBuilder.Entity("api.Models.GAndGAdminCost", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Exploration.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Exploration.Id") + .IsUnique(); + + b.ToTable("GAndGAdminCost"); + }); + + modelBuilder.Entity("api.Models.GAndGAdminCostOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Exploration.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Exploration.Id") + .IsUnique(); + + b.ToTable("GAndGAdminCostOverride"); + }); + + modelBuilder.Entity("api.Models.GasInjectorCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("GasInjectorCostProfile"); + }); + + modelBuilder.Entity("api.Models.GasInjectorCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("GasInjectorCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.GasProducerCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("GasProducerCostProfile"); + }); + + modelBuilder.Entity("api.Models.GasProducerCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("GasProducerCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.HistoricCostCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("HistoricCostCostProfile"); + }); + + modelBuilder.Entity("api.Models.Image", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CaseId") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CaseId"); + + b.ToTable("Images"); + }); + + modelBuilder.Entity("api.Models.ImportedElectricity", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("ImportedElectricity"); + }); + + modelBuilder.Entity("api.Models.ImportedElectricityOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("ImportedElectricityOverride"); + }); + + modelBuilder.Entity("api.Models.NetSalesGas", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("NetSalesGas"); + }); + + modelBuilder.Entity("api.Models.NetSalesGasOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("NetSalesGasOverride"); + }); + + modelBuilder.Entity("api.Models.OffshoreFacilitiesOperationsCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("OffshoreFacilitiesOperationsCostProfile"); + }); + + modelBuilder.Entity("api.Models.OffshoreFacilitiesOperationsCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("OffshoreFacilitiesOperationsCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.OilProducerCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("OilProducerCostProfile"); + }); + + modelBuilder.Entity("api.Models.OilProducerCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("OilProducerCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.OnshoreRelatedOPEXCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("OnshoreRelatedOPEXCostProfile"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileGas", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("ProductionProfileGas"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileNGL", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("ProductionProfileNGL"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileOil", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("ProductionProfileOil"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileWater", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("ProductionProfileWater"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileWaterInjection", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrainageStrategy.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DrainageStrategy.Id") + .IsUnique(); + + b.ToTable("ProductionProfileWaterInjection"); + }); + + modelBuilder.Entity("api.Models.Project", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AverageDevelopmentDrillingDays") + .HasColumnType("float"); + + b.Property("CO2EmissionFromFuelGas") + .HasColumnType("float"); + + b.Property("CO2EmissionsFromFlaredGas") + .HasColumnType("float"); + + b.Property("CO2RemovedFromGas") + .HasColumnType("float"); + + b.Property("CO2Vented") + .HasColumnType("float"); + + b.Property("Classification") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(1); + + b.Property("CommonLibraryId") + .HasColumnType("uniqueidentifier"); + + b.Property("CommonLibraryName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreateDate") + .HasColumnType("datetimeoffset"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("DailyEmissionFromDrillingRig") + .HasColumnType("float"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FlaredGasPerProducedVolume") + .HasColumnType("float"); + + b.Property("FusionProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PhysicalUnit") + .HasColumnType("int"); + + b.Property("ProjectCategory") + .HasColumnType("int"); + + b.Property("ProjectPhase") + .HasColumnType("int"); + + b.Property("ReferenceCaseId") + .HasColumnType("uniqueidentifier"); + + b.Property("SharepointSiteUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("api.Models.SeismicAcquisitionAndProcessing", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Exploration.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Exploration.Id") + .IsUnique(); + + b.ToTable("SeismicAcquisitionAndProcessing"); + }); + + modelBuilder.Entity("api.Models.SidetrackCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Exploration.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Exploration.Id") + .IsUnique(); + + b.ToTable("SidetrackCostProfile"); + }); + + modelBuilder.Entity("api.Models.Substructure", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApprovedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Concept") + .HasColumnType("int"); + + b.Property("CostYear") + .HasColumnType("int"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("DG3Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG4Date") + .HasColumnType("datetimeoffset"); + + b.Property("DryWeight") + .HasColumnType("float"); + + b.Property("LastChangedDate") + .HasColumnType("datetimeoffset"); + + b.Property("Maturity") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProspVersion") + .HasColumnType("datetimeoffset"); + + b.Property("Source") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Substructures"); + }); + + modelBuilder.Entity("api.Models.SubstructureCessationCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Substructure.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Substructure.Id") + .IsUnique(); + + b.ToTable("SubstructureCessationCostProfiles"); + }); + + modelBuilder.Entity("api.Models.SubstructureCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Substructure.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Substructure.Id") + .IsUnique(); + + b.ToTable("SubstructureCostProfiles"); + }); + + modelBuilder.Entity("api.Models.SubstructureCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Substructure.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Substructure.Id") + .IsUnique(); + + b.ToTable("SubstructureCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.Surf", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApprovedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ArtificialLift") + .HasColumnType("int"); + + b.Property("CessationCost") + .HasColumnType("float"); + + b.Property("CostYear") + .HasColumnType("int"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("DG3Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG4Date") + .HasColumnType("datetimeoffset"); + + b.Property("GasInjectorCount") + .HasColumnType("int"); + + b.Property("InfieldPipelineSystemLength") + .HasColumnType("float"); + + b.Property("LastChangedDate") + .HasColumnType("datetimeoffset"); + + b.Property("Maturity") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerCount") + .HasColumnType("int"); + + b.Property("ProductionFlowline") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProspVersion") + .HasColumnType("datetimeoffset"); + + b.Property("RiserCount") + .HasColumnType("int"); + + b.Property("Source") + .HasColumnType("int"); + + b.Property("TemplateCount") + .HasColumnType("int"); + + b.Property("UmbilicalSystemLength") + .HasColumnType("float"); + + b.Property("WaterInjectorCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Surfs"); + }); + + modelBuilder.Entity("api.Models.SurfCessationCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Surf.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Surf.Id") + .IsUnique(); + + b.ToTable("SurfCessationCostProfiles"); + }); + + modelBuilder.Entity("api.Models.SurfCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Surf.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Surf.Id") + .IsUnique(); + + b.ToTable("SurfCostProfile"); + }); + + modelBuilder.Entity("api.Models.SurfCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Surf.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Surf.Id") + .IsUnique(); + + b.ToTable("SurfCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.Topside", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApprovedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ArtificialLift") + .HasColumnType("int"); + + b.Property("CO2OnMaxGasProfile") + .HasColumnType("float"); + + b.Property("CO2OnMaxOilProfile") + .HasColumnType("float"); + + b.Property("CO2OnMaxWaterInjectionProfile") + .HasColumnType("float"); + + b.Property("CO2ShareGasProfile") + .HasColumnType("float"); + + b.Property("CO2ShareOilProfile") + .HasColumnType("float"); + + b.Property("CO2ShareWaterInjectionProfile") + .HasColumnType("float"); + + b.Property("CostYear") + .HasColumnType("int"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("DG3Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG4Date") + .HasColumnType("datetimeoffset"); + + b.Property("DryWeight") + .HasColumnType("float"); + + b.Property("FacilityOpex") + .HasColumnType("float"); + + b.Property("FlaredGas") + .HasColumnType("float"); + + b.Property("FuelConsumption") + .HasColumnType("float"); + + b.Property("GasCapacity") + .HasColumnType("float"); + + b.Property("GasInjectorCount") + .HasColumnType("int"); + + b.Property("LastChangedDate") + .HasColumnType("datetimeoffset"); + + b.Property("Maturity") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OilCapacity") + .HasColumnType("float"); + + b.Property("PeakElectricityImported") + .HasColumnType("float"); + + b.Property("ProducerCount") + .HasColumnType("int"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProspVersion") + .HasColumnType("datetimeoffset"); + + b.Property("Source") + .HasColumnType("int"); + + b.Property("WaterInjectionCapacity") + .HasColumnType("float"); + + b.Property("WaterInjectorCount") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Topsides"); + }); + + modelBuilder.Entity("api.Models.TopsideCessationCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Topside.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Topside.Id") + .IsUnique(); + + b.ToTable("TopsideCessationCostProfiles"); + }); + + modelBuilder.Entity("api.Models.TopsideCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Topside.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Topside.Id") + .IsUnique(); + + b.ToTable("TopsideCostProfiles"); + }); + + modelBuilder.Entity("api.Models.TopsideCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Topside.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Topside.Id") + .IsUnique(); + + b.ToTable("TopsideCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.TotalFEEDStudies", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("TotalFEEDStudies"); + }); + + modelBuilder.Entity("api.Models.TotalFEEDStudiesOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("TotalFEEDStudiesOverride"); + }); + + modelBuilder.Entity("api.Models.TotalFeasibilityAndConceptStudies", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("TotalFeasibilityAndConceptStudies"); + }); + + modelBuilder.Entity("api.Models.TotalFeasibilityAndConceptStudiesOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("TotalFeasibilityAndConceptStudiesOverride"); + }); + + modelBuilder.Entity("api.Models.TotalOtherStudiesCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("TotalOtherStudiesCostProfile"); + }); + + modelBuilder.Entity("api.Models.Transport", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CostYear") + .HasColumnType("int"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("DG3Date") + .HasColumnType("datetimeoffset"); + + b.Property("DG4Date") + .HasColumnType("datetimeoffset"); + + b.Property("GasExportPipelineLength") + .HasColumnType("float"); + + b.Property("LastChangedDate") + .HasColumnType("datetimeoffset"); + + b.Property("Maturity") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OilExportPipelineLength") + .HasColumnType("float"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProspVersion") + .HasColumnType("datetimeoffset"); + + b.Property("Source") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Transports"); + }); + + modelBuilder.Entity("api.Models.TransportCessationCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Transport.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Transport.Id") + .IsUnique(); + + b.ToTable("TransportCessationCostProfiles"); + }); + + modelBuilder.Entity("api.Models.TransportCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Transport.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Transport.Id") + .IsUnique(); + + b.ToTable("TransportCostProfile"); + }); + + modelBuilder.Entity("api.Models.TransportCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("Transport.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Transport.Id") + .IsUnique(); + + b.ToTable("TransportCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.WaterInjectorCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("WaterInjectorCostProfile"); + }); + + modelBuilder.Entity("api.Models.WaterInjectorCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.Property("WellProject.Id") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("WellProject.Id") + .IsUnique(); + + b.ToTable("WaterInjectorCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.Well", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DrillingDays") + .HasColumnType("float"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("PlugingAndAbandonmentCost") + .HasColumnType("float"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("WellCategory") + .HasColumnType("int"); + + b.Property("WellCost") + .HasColumnType("float"); + + b.Property("WellInterventionCost") + .HasColumnType("float"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("Wells"); + }); + + modelBuilder.Entity("api.Models.WellInterventionCostProfile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("WellInterventionCostProfile"); + }); + + modelBuilder.Entity("api.Models.WellInterventionCostProfileOverride", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Case.Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("EPAVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("InternalData") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Override") + .HasColumnType("bit"); + + b.Property("StartYear") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("Case.Id") + .IsUnique(); + + b.ToTable("WellInterventionCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.WellProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ArtificialLift") + .HasColumnType("int"); + + b.Property("Currency") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("ProjectId"); + + b.ToTable("WellProjects"); + }); + + modelBuilder.Entity("api.Models.WellProjectWell", b => + { + b.Property("WellProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("WellId") + .HasColumnType("uniqueidentifier"); + + b.Property("DrillingScheduleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("WellProjectId", "WellId"); + + b.HasIndex("DrillingScheduleId"); + + b.HasIndex("WellId"); + + b.ToTable("WellProjectWell"); + }); + + modelBuilder.Entity("api.Models.AdditionalOPEXCostProfile", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("AdditionalOPEXCostProfile") + .HasForeignKey("api.Models.AdditionalOPEXCostProfile", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.AppraisalWellCostProfile", b => + { + b.HasOne("api.Models.Exploration", "Exploration") + .WithOne("AppraisalWellCostProfile") + .HasForeignKey("api.Models.AppraisalWellCostProfile", "Exploration.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Exploration"); + }); + + modelBuilder.Entity("api.Models.Case", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("Cases") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.CessationOffshoreFacilitiesCost", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("CessationOffshoreFacilitiesCost") + .HasForeignKey("api.Models.CessationOffshoreFacilitiesCost", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.CessationOffshoreFacilitiesCostOverride", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("CessationOffshoreFacilitiesCostOverride") + .HasForeignKey("api.Models.CessationOffshoreFacilitiesCostOverride", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.CessationOnshoreFacilitiesCostProfile", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("CessationOnshoreFacilitiesCostProfile") + .HasForeignKey("api.Models.CessationOnshoreFacilitiesCostProfile", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.CessationWellsCost", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("CessationWellsCost") + .HasForeignKey("api.Models.CessationWellsCost", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.CessationWellsCostOverride", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("CessationWellsCostOverride") + .HasForeignKey("api.Models.CessationWellsCostOverride", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.Co2Emissions", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("Co2Emissions") + .HasForeignKey("api.Models.Co2Emissions", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.Co2EmissionsOverride", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("Co2EmissionsOverride") + .HasForeignKey("api.Models.Co2EmissionsOverride", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.CountryOfficeCost", b => + { + b.HasOne("api.Models.Exploration", "Exploration") + .WithOne("CountryOfficeCost") + .HasForeignKey("api.Models.CountryOfficeCost", "Exploration.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Exploration"); + }); + + modelBuilder.Entity("api.Models.DeferredGasProduction", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("DeferredGasProduction") + .HasForeignKey("api.Models.DeferredGasProduction", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.DeferredOilProduction", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("DeferredOilProduction") + .HasForeignKey("api.Models.DeferredOilProduction", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.DevelopmentOperationalWellCosts", b => + { + b.HasOne("api.Models.Project", "Project") + .WithOne("DevelopmentOperationalWellCosts") + .HasForeignKey("api.Models.DevelopmentOperationalWellCosts", "ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.DrainageStrategy", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("DrainageStrategies") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.Exploration", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("Explorations") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.ExplorationOperationalWellCosts", b => + { + b.HasOne("api.Models.Project", "Project") + .WithOne("ExplorationOperationalWellCosts") + .HasForeignKey("api.Models.ExplorationOperationalWellCosts", "ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.ExplorationWell", b => + { + b.HasOne("api.Models.DrillingSchedule", "DrillingSchedule") + .WithMany() + .HasForeignKey("DrillingScheduleId"); + + b.HasOne("api.Models.Exploration", "Exploration") + .WithMany("ExplorationWells") + .HasForeignKey("ExplorationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("api.Models.Well", "Well") + .WithMany("ExplorationWells") + .HasForeignKey("WellId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("DrillingSchedule"); + + b.Navigation("Exploration"); + + b.Navigation("Well"); + }); + + modelBuilder.Entity("api.Models.ExplorationWellCostProfile", b => + { + b.HasOne("api.Models.Exploration", "Exploration") + .WithOne("ExplorationWellCostProfile") + .HasForeignKey("api.Models.ExplorationWellCostProfile", "Exploration.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Exploration"); + }); + + modelBuilder.Entity("api.Models.FuelFlaringAndLosses", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("FuelFlaringAndLosses") + .HasForeignKey("api.Models.FuelFlaringAndLosses", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.FuelFlaringAndLossesOverride", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("FuelFlaringAndLossesOverride") + .HasForeignKey("api.Models.FuelFlaringAndLossesOverride", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.GAndGAdminCost", b => + { + b.HasOne("api.Models.Exploration", "Exploration") + .WithOne("GAndGAdminCost") + .HasForeignKey("api.Models.GAndGAdminCost", "Exploration.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Exploration"); + }); + + modelBuilder.Entity("api.Models.GAndGAdminCostOverride", b => + { + b.HasOne("api.Models.Exploration", "Exploration") + .WithOne("GAndGAdminCostOverride") + .HasForeignKey("api.Models.GAndGAdminCostOverride", "Exploration.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Exploration"); + }); + + modelBuilder.Entity("api.Models.GasInjectorCostProfile", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("GasInjectorCostProfile") + .HasForeignKey("api.Models.GasInjectorCostProfile", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.GasInjectorCostProfileOverride", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("GasInjectorCostProfileOverride") + .HasForeignKey("api.Models.GasInjectorCostProfileOverride", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.GasProducerCostProfile", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("GasProducerCostProfile") + .HasForeignKey("api.Models.GasProducerCostProfile", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.GasProducerCostProfileOverride", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("GasProducerCostProfileOverride") + .HasForeignKey("api.Models.GasProducerCostProfileOverride", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.HistoricCostCostProfile", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("HistoricCostCostProfile") + .HasForeignKey("api.Models.HistoricCostCostProfile", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.Image", b => + { + b.HasOne("api.Models.Case", null) + .WithMany("Images") + .HasForeignKey("CaseId"); + }); + + modelBuilder.Entity("api.Models.ImportedElectricity", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("ImportedElectricity") + .HasForeignKey("api.Models.ImportedElectricity", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.ImportedElectricityOverride", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("ImportedElectricityOverride") + .HasForeignKey("api.Models.ImportedElectricityOverride", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.NetSalesGas", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("NetSalesGas") + .HasForeignKey("api.Models.NetSalesGas", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.NetSalesGasOverride", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("NetSalesGasOverride") + .HasForeignKey("api.Models.NetSalesGasOverride", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.OffshoreFacilitiesOperationsCostProfile", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("OffshoreFacilitiesOperationsCostProfile") + .HasForeignKey("api.Models.OffshoreFacilitiesOperationsCostProfile", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.OffshoreFacilitiesOperationsCostProfileOverride", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("OffshoreFacilitiesOperationsCostProfileOverride") + .HasForeignKey("api.Models.OffshoreFacilitiesOperationsCostProfileOverride", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.OilProducerCostProfile", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("OilProducerCostProfile") + .HasForeignKey("api.Models.OilProducerCostProfile", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.OilProducerCostProfileOverride", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("OilProducerCostProfileOverride") + .HasForeignKey("api.Models.OilProducerCostProfileOverride", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.OnshoreRelatedOPEXCostProfile", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("OnshoreRelatedOPEXCostProfile") + .HasForeignKey("api.Models.OnshoreRelatedOPEXCostProfile", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileGas", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("ProductionProfileGas") + .HasForeignKey("api.Models.ProductionProfileGas", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileNGL", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("ProductionProfileNGL") + .HasForeignKey("api.Models.ProductionProfileNGL", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileOil", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("ProductionProfileOil") + .HasForeignKey("api.Models.ProductionProfileOil", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileWater", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("ProductionProfileWater") + .HasForeignKey("api.Models.ProductionProfileWater", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.ProductionProfileWaterInjection", b => + { + b.HasOne("api.Models.DrainageStrategy", "DrainageStrategy") + .WithOne("ProductionProfileWaterInjection") + .HasForeignKey("api.Models.ProductionProfileWaterInjection", "DrainageStrategy.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrainageStrategy"); + }); + + modelBuilder.Entity("api.Models.SeismicAcquisitionAndProcessing", b => + { + b.HasOne("api.Models.Exploration", "Exploration") + .WithOne("SeismicAcquisitionAndProcessing") + .HasForeignKey("api.Models.SeismicAcquisitionAndProcessing", "Exploration.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Exploration"); + }); + + modelBuilder.Entity("api.Models.SidetrackCostProfile", b => + { + b.HasOne("api.Models.Exploration", "Exploration") + .WithOne("SidetrackCostProfile") + .HasForeignKey("api.Models.SidetrackCostProfile", "Exploration.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Exploration"); + }); + + modelBuilder.Entity("api.Models.Substructure", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("Substructures") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.SubstructureCessationCostProfile", b => + { + b.HasOne("api.Models.Substructure", "Substructure") + .WithOne("CessationCostProfile") + .HasForeignKey("api.Models.SubstructureCessationCostProfile", "Substructure.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Substructure"); + }); + + modelBuilder.Entity("api.Models.SubstructureCostProfile", b => + { + b.HasOne("api.Models.Substructure", "Substructure") + .WithOne("CostProfile") + .HasForeignKey("api.Models.SubstructureCostProfile", "Substructure.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Substructure"); + }); + + modelBuilder.Entity("api.Models.SubstructureCostProfileOverride", b => + { + b.HasOne("api.Models.Substructure", "Substructure") + .WithOne("CostProfileOverride") + .HasForeignKey("api.Models.SubstructureCostProfileOverride", "Substructure.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Substructure"); + }); + + modelBuilder.Entity("api.Models.Surf", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("Surfs") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.SurfCessationCostProfile", b => + { + b.HasOne("api.Models.Surf", "Surf") + .WithOne("CessationCostProfile") + .HasForeignKey("api.Models.SurfCessationCostProfile", "Surf.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Surf"); + }); + + modelBuilder.Entity("api.Models.SurfCostProfile", b => + { + b.HasOne("api.Models.Surf", "Surf") + .WithOne("CostProfile") + .HasForeignKey("api.Models.SurfCostProfile", "Surf.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Surf"); + }); + + modelBuilder.Entity("api.Models.SurfCostProfileOverride", b => + { + b.HasOne("api.Models.Surf", "Surf") + .WithOne("CostProfileOverride") + .HasForeignKey("api.Models.SurfCostProfileOverride", "Surf.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Surf"); + }); + + modelBuilder.Entity("api.Models.Topside", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("Topsides") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.TopsideCessationCostProfile", b => + { + b.HasOne("api.Models.Topside", "Topside") + .WithOne("CessationCostProfile") + .HasForeignKey("api.Models.TopsideCessationCostProfile", "Topside.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Topside"); + }); + + modelBuilder.Entity("api.Models.TopsideCostProfile", b => + { + b.HasOne("api.Models.Topside", "Topside") + .WithOne("CostProfile") + .HasForeignKey("api.Models.TopsideCostProfile", "Topside.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Topside"); + }); + + modelBuilder.Entity("api.Models.TopsideCostProfileOverride", b => + { + b.HasOne("api.Models.Topside", "Topside") + .WithOne("CostProfileOverride") + .HasForeignKey("api.Models.TopsideCostProfileOverride", "Topside.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Topside"); + }); + + modelBuilder.Entity("api.Models.TotalFEEDStudies", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("TotalFEEDStudies") + .HasForeignKey("api.Models.TotalFEEDStudies", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.TotalFEEDStudiesOverride", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("TotalFEEDStudiesOverride") + .HasForeignKey("api.Models.TotalFEEDStudiesOverride", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.TotalFeasibilityAndConceptStudies", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("TotalFeasibilityAndConceptStudies") + .HasForeignKey("api.Models.TotalFeasibilityAndConceptStudies", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.TotalFeasibilityAndConceptStudiesOverride", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("TotalFeasibilityAndConceptStudiesOverride") + .HasForeignKey("api.Models.TotalFeasibilityAndConceptStudiesOverride", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.TotalOtherStudiesCostProfile", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("TotalOtherStudiesCostProfile") + .HasForeignKey("api.Models.TotalOtherStudiesCostProfile", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.Transport", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("Transports") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.TransportCessationCostProfile", b => + { + b.HasOne("api.Models.Transport", "Transport") + .WithOne("CessationCostProfile") + .HasForeignKey("api.Models.TransportCessationCostProfile", "Transport.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Transport"); + }); + + modelBuilder.Entity("api.Models.TransportCostProfile", b => + { + b.HasOne("api.Models.Transport", "Transport") + .WithOne("CostProfile") + .HasForeignKey("api.Models.TransportCostProfile", "Transport.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Transport"); + }); + + modelBuilder.Entity("api.Models.TransportCostProfileOverride", b => + { + b.HasOne("api.Models.Transport", "Transport") + .WithOne("CostProfileOverride") + .HasForeignKey("api.Models.TransportCostProfileOverride", "Transport.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Transport"); + }); + + modelBuilder.Entity("api.Models.WaterInjectorCostProfile", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("WaterInjectorCostProfile") + .HasForeignKey("api.Models.WaterInjectorCostProfile", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.WaterInjectorCostProfileOverride", b => + { + b.HasOne("api.Models.WellProject", "WellProject") + .WithOne("WaterInjectorCostProfileOverride") + .HasForeignKey("api.Models.WaterInjectorCostProfileOverride", "WellProject.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.Well", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("Wells") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.WellInterventionCostProfile", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("WellInterventionCostProfile") + .HasForeignKey("api.Models.WellInterventionCostProfile", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.WellInterventionCostProfileOverride", b => + { + b.HasOne("api.Models.Case", "Case") + .WithOne("WellInterventionCostProfileOverride") + .HasForeignKey("api.Models.WellInterventionCostProfileOverride", "Case.Id") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Case"); + }); + + modelBuilder.Entity("api.Models.WellProject", b => + { + b.HasOne("api.Models.Project", "Project") + .WithMany("WellProjects") + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Project"); + }); + + modelBuilder.Entity("api.Models.WellProjectWell", b => + { + b.HasOne("api.Models.DrillingSchedule", "DrillingSchedule") + .WithMany() + .HasForeignKey("DrillingScheduleId"); + + b.HasOne("api.Models.Well", "Well") + .WithMany("WellProjectWells") + .HasForeignKey("WellId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("api.Models.WellProject", "WellProject") + .WithMany("WellProjectWells") + .HasForeignKey("WellProjectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DrillingSchedule"); + + b.Navigation("Well"); + + b.Navigation("WellProject"); + }); + + modelBuilder.Entity("api.Models.Case", b => + { + b.Navigation("AdditionalOPEXCostProfile"); + + b.Navigation("CessationOffshoreFacilitiesCost"); + + b.Navigation("CessationOffshoreFacilitiesCostOverride"); + + b.Navigation("CessationOnshoreFacilitiesCostProfile"); + + b.Navigation("CessationWellsCost"); + + b.Navigation("CessationWellsCostOverride"); + + b.Navigation("HistoricCostCostProfile"); + + b.Navigation("Images"); + + b.Navigation("OffshoreFacilitiesOperationsCostProfile"); + + b.Navigation("OffshoreFacilitiesOperationsCostProfileOverride"); + + b.Navigation("OnshoreRelatedOPEXCostProfile"); + + b.Navigation("TotalFEEDStudies"); + + b.Navigation("TotalFEEDStudiesOverride"); + + b.Navigation("TotalFeasibilityAndConceptStudies"); + + b.Navigation("TotalFeasibilityAndConceptStudiesOverride"); + + b.Navigation("TotalOtherStudiesCostProfile"); + + b.Navigation("WellInterventionCostProfile"); + + b.Navigation("WellInterventionCostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.DrainageStrategy", b => + { + b.Navigation("Co2Emissions"); + + b.Navigation("Co2EmissionsOverride"); + + b.Navigation("DeferredGasProduction"); + + b.Navigation("DeferredOilProduction"); + + b.Navigation("FuelFlaringAndLosses"); + + b.Navigation("FuelFlaringAndLossesOverride"); + + b.Navigation("ImportedElectricity"); + + b.Navigation("ImportedElectricityOverride"); + + b.Navigation("NetSalesGas"); + + b.Navigation("NetSalesGasOverride"); + + b.Navigation("ProductionProfileGas"); + + b.Navigation("ProductionProfileNGL"); + + b.Navigation("ProductionProfileOil"); + + b.Navigation("ProductionProfileWater"); + + b.Navigation("ProductionProfileWaterInjection"); + }); + + modelBuilder.Entity("api.Models.Exploration", b => + { + b.Navigation("AppraisalWellCostProfile"); + + b.Navigation("CountryOfficeCost"); + + b.Navigation("ExplorationWellCostProfile"); + + b.Navigation("ExplorationWells"); + + b.Navigation("GAndGAdminCost"); + + b.Navigation("GAndGAdminCostOverride"); + + b.Navigation("SeismicAcquisitionAndProcessing"); + + b.Navigation("SidetrackCostProfile"); + }); + + modelBuilder.Entity("api.Models.Project", b => + { + b.Navigation("Cases"); + + b.Navigation("DevelopmentOperationalWellCosts"); + + b.Navigation("DrainageStrategies"); + + b.Navigation("ExplorationOperationalWellCosts"); + + b.Navigation("Explorations"); + + b.Navigation("Substructures"); + + b.Navigation("Surfs"); + + b.Navigation("Topsides"); + + b.Navigation("Transports"); + + b.Navigation("WellProjects"); + + b.Navigation("Wells"); + }); + + modelBuilder.Entity("api.Models.Substructure", b => + { + b.Navigation("CessationCostProfile"); + + b.Navigation("CostProfile"); + + b.Navigation("CostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.Surf", b => + { + b.Navigation("CessationCostProfile"); + + b.Navigation("CostProfile"); + + b.Navigation("CostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.Topside", b => + { + b.Navigation("CessationCostProfile"); + + b.Navigation("CostProfile"); + + b.Navigation("CostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.Transport", b => + { + b.Navigation("CessationCostProfile"); + + b.Navigation("CostProfile"); + + b.Navigation("CostProfileOverride"); + }); + + modelBuilder.Entity("api.Models.Well", b => + { + b.Navigation("ExplorationWells"); + + b.Navigation("WellProjectWells"); + }); + + modelBuilder.Entity("api.Models.WellProject", b => + { + b.Navigation("GasInjectorCostProfile"); + + b.Navigation("GasInjectorCostProfileOverride"); + + b.Navigation("GasProducerCostProfile"); + + b.Navigation("GasProducerCostProfileOverride"); + + b.Navigation("OilProducerCostProfile"); + + b.Navigation("OilProducerCostProfileOverride"); + + b.Navigation("WaterInjectorCostProfile"); + + b.Navigation("WaterInjectorCostProfileOverride"); + + b.Navigation("WellProjectWells"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/api/Migrations/20240709120742_projectImageUpload.cs b/backend/api/Migrations/20240709120742_projectImageUpload.cs new file mode 100644 index 000000000..44a5fb424 --- /dev/null +++ b/backend/api/Migrations/20240709120742_projectImageUpload.cs @@ -0,0 +1,60 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace api.Migrations +{ + /// + public partial class projectImageUpload : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Images_Cases_CaseId", + table: "Images"); + + migrationBuilder.AlterColumn( + name: "CaseId", + table: "Images", + type: "uniqueidentifier", + nullable: true, + oldClrType: typeof(Guid), + oldType: "uniqueidentifier"); + + migrationBuilder.AddForeignKey( + name: "FK_Images_Cases_CaseId", + table: "Images", + column: "CaseId", + principalTable: "Cases", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Images_Cases_CaseId", + table: "Images"); + + migrationBuilder.AlterColumn( + name: "CaseId", + table: "Images", + type: "uniqueidentifier", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), + oldClrType: typeof(Guid), + oldType: "uniqueidentifier", + oldNullable: true); + + migrationBuilder.AddForeignKey( + name: "FK_Images_Cases_CaseId", + table: "Images", + column: "CaseId", + principalTable: "Cases", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + } +} diff --git a/backend/api/Migrations/DcdDbContextModelSnapshot.cs b/backend/api/Migrations/DcdDbContextModelSnapshot.cs index 0e2f970e7..5ab3da782 100644 --- a/backend/api/Migrations/DcdDbContextModelSnapshot.cs +++ b/backend/api/Migrations/DcdDbContextModelSnapshot.cs @@ -988,7 +988,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); - b.Property("CaseId") + b.Property("CaseId") .HasColumnType("uniqueidentifier"); b.Property("CreateTime") @@ -2908,9 +2908,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasOne("api.Models.Case", null) .WithMany("Images") - .HasForeignKey("CaseId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); + .HasForeignKey("CaseId"); }); modelBuilder.Entity("api.Models.ImportedElectricity", b => diff --git a/backend/api/Models/Image.cs b/backend/api/Models/Image.cs index e07a18e15..17efaded7 100644 --- a/backend/api/Models/Image.cs +++ b/backend/api/Models/Image.cs @@ -16,7 +16,7 @@ public class Image public string? Description { get; set; } [ForeignKey("Case")] - public Guid CaseId { get; set; } + public Guid? CaseId { get; set; } [Required] public string ProjectName { get; set; } = null!; diff --git a/backend/api/Repositories/IImageRepository.cs b/backend/api/Repositories/IImageRepository.cs index 96ce94df9..7dc8618b9 100644 --- a/backend/api/Repositories/IImageRepository.cs +++ b/backend/api/Repositories/IImageRepository.cs @@ -1,12 +1,10 @@ -using api.Dtos; using api.Models; public interface IImageRepository { Task AddImage(Image image); Task> GetImagesByCaseId(Guid caseId); + Task> GetImagesByProjectId(Guid projectId); Task DeleteImage(Image image); - Task GetImageById(Guid imageId); - } diff --git a/backend/api/Repositories/ImageRepository.cs b/backend/api/Repositories/ImageRepository.cs index 87f5d046a..5f053da50 100644 --- a/backend/api/Repositories/ImageRepository.cs +++ b/backend/api/Repositories/ImageRepository.cs @@ -20,10 +20,16 @@ public async Task AddImage(Image image) public async Task> GetImagesByCaseId(Guid caseId) { - var images = await _context.Images + return await _context.Images .Where(img => img.CaseId == caseId) .ToListAsync(); - return images; + } + + public async Task> GetImagesByProjectId(Guid projectId) + { + return await _context.Images + .Where(img => img.ProjectId == projectId && img.CaseId == null) + .ToListAsync(); } public async Task DeleteImage(Image image) diff --git a/backend/api/Services/BlobStorageService.cs b/backend/api/Services/BlobStorageService.cs index aea05dcdf..20deed21d 100644 --- a/backend/api/Services/BlobStorageService.cs +++ b/backend/api/Services/BlobStorageService.cs @@ -7,6 +7,7 @@ using Azure.Storage.Blobs; using Azure.Storage.Blobs.Models; + public class BlobStorageService : IBlobStorageService { private readonly BlobServiceClient _blobServiceClient; @@ -20,13 +21,11 @@ public BlobStorageService(BlobServiceClient blobServiceClient, IImageRepository _imageRepository = imageRepository; _mapper = mapper; _containerName = GetContainerName(configuration); - } + private string GetContainerName(IConfiguration configuration) { - var environment = Environment.GetEnvironmentVariable("AppConfiguration__Environment") ?? "default"; - var containerKey = environment switch { "localdev" => "AzureStorageAccountImageContainerCI", @@ -43,19 +42,29 @@ private string GetContainerName(IConfiguration configuration) return configuration[containerKey] ?? throw new InvalidOperationException($"Container name configuration for {environment} is missing."); } + private string SanitizeBlobName(string name) { return name.Replace(" ", "-").Replace("/", "-").Replace("\\", "-"); } - public async Task SaveImage(Guid projectId, string projectName, IFormFile image, Guid caseId) + + public async Task SaveImage(Guid projectId, string projectName, IFormFile image, Guid? caseId = null) { var sanitizedProjectName = SanitizeBlobName(projectName); var containerClient = _blobServiceClient.GetBlobContainerClient(_containerName); var imageId = Guid.NewGuid(); - var blobName = $"{sanitizedProjectName}/{caseId}/{imageId}"; - var blobClient = containerClient.GetBlobClient(blobName); + if (projectId == Guid.Empty || caseId == Guid.Empty) + { + throw new ArgumentException("ProjectId and/or CaseId cannot be empty."); + } + + var blobName = caseId.HasValue + ? $"{sanitizedProjectName}/cases/{caseId}/{imageId}" + : $"{sanitizedProjectName}/projects/{projectId}/{imageId}"; + + var blobClient = containerClient.GetBlobClient(blobName); await using var stream = image.OpenReadStream(); await blobClient.UploadAsync(stream, new BlobHttpHeaders { ContentType = image.ContentType }); @@ -71,7 +80,6 @@ public async Task SaveImage(Guid projectId, string projectName, IFormF CaseId = caseId, ProjectId = projectId, ProjectName = sanitizedProjectName - }; await _imageRepository.AddImage(imageEntity); @@ -99,7 +107,20 @@ public async Task> GetCaseImages(Guid caseId) return imageDtos; } - public async Task DeleteImage(Guid caseId, Guid imageId) + public async Task> GetProjectImages(Guid projectId) + { + var images = await _imageRepository.GetImagesByProjectId(projectId); + + var imageDtos = _mapper.Map>(images); + + if (imageDtos == null) + { + throw new InvalidOperationException("Image mapping failed."); + } + return imageDtos; + } + + public async Task DeleteImage(Guid imageId) { var image = await _imageRepository.GetImageById(imageId); if (image == null) @@ -110,12 +131,13 @@ public async Task DeleteImage(Guid caseId, Guid imageId) var containerClient = _blobServiceClient.GetBlobContainerClient(_containerName); var sanitizedProjectName = SanitizeBlobName(image.ProjectName); - var blobName = $"{sanitizedProjectName}/{image.CaseId}/{image.Id}"; + var blobName = image.CaseId.HasValue + ? $"{sanitizedProjectName}/cases/{image.CaseId}/{image.Id}" + : $"{sanitizedProjectName}/projects/{image.ProjectId}/{image.Id}"; var blobClient = containerClient.GetBlobClient(blobName); await blobClient.DeleteIfExistsAsync(); await _imageRepository.DeleteImage(image); } - } diff --git a/backend/api/Services/IBlobStorageService.cs b/backend/api/Services/IBlobStorageService.cs index ac84b31b3..ec20573d4 100644 --- a/backend/api/Services/IBlobStorageService.cs +++ b/backend/api/Services/IBlobStorageService.cs @@ -2,8 +2,8 @@ public interface IBlobStorageService { - Task SaveImage(Guid projectId, string projectName, IFormFile image, Guid caseId); + Task SaveImage(Guid projectId, string projectName, IFormFile image, Guid? caseId = null); Task> GetCaseImages(Guid caseId); - Task DeleteImage(Guid caseId, Guid imageId); - + Task> GetProjectImages(Guid projectId); + Task DeleteImage(Guid imageId); } diff --git a/frontend/src/Components/Case/Components/CaseTabTable.tsx b/frontend/src/Components/Case/Components/CaseTabTable.tsx index dde07c78a..7d6d8f645 100644 --- a/frontend/src/Components/Case/Components/CaseTabTable.tsx +++ b/frontend/src/Components/Case/Components/CaseTabTable.tsx @@ -60,6 +60,13 @@ const CaseTabTable = ({ const [overrideModalProfileName, setOverrideModalProfileName] = useState() const [overrideModalProfileSet, setOverrideModalProfileSet] = useState>>() const [overrideProfile, setOverrideProfile] = useState() + const [stagedEdit, setStagedEdit] = useState() + + useEffect(() => { + if (stagedEdit) { + addEdit(stagedEdit) + } + }, [stagedEdit]) const profilesToRowData = () => { const tableRows: any[] = [] @@ -250,7 +257,7 @@ const CaseTabTable = ({ return result } - addEdit({ + setStagedEdit({ newValue: p.newValue, previousValue: p.oldValue, inputLabel: p.data.profileName, diff --git a/frontend/src/Components/Case/OverviewCasesTable/CasesDropMenu.tsx b/frontend/src/Components/Case/OverviewCasesTable/CasesDropMenu.tsx index 3864acbcc..ebc22019d 100644 --- a/frontend/src/Components/Case/OverviewCasesTable/CasesDropMenu.tsx +++ b/frontend/src/Components/Case/OverviewCasesTable/CasesDropMenu.tsx @@ -62,7 +62,7 @@ const CasesDropMenu = ({ isOpen={confirmDelete} size="sm" content={[ - + Are you sure you want to delete this case? , ]} @@ -73,6 +73,7 @@ const CasesDropMenu = ({ )} /> + { editable: true, overrideProfile: co2EmissionsOverrideData, resourceName: "co2EmissionsOverride", - resourceId: drainageStrategyData.id, + resourceId: drainageStrategyData?.id, resourceProfileId: co2EmissionsOverrideData?.id, resourcePropertyKey: "co2EmissionsOverride", }, @@ -136,7 +136,7 @@ const CaseCO2Tab = () => { overridable: false, editable: false, resourceName: "co2Intensity", - resourceId: drainageStrategyData.id, + resourceId: drainageStrategyData?.id, resourceProfileId: co2Intensity?.id, resourcePropertyKey: "co2Intensity", }, diff --git a/frontend/src/Components/Controls/UndoControls.tsx b/frontend/src/Components/Controls/UndoControls.tsx index ed5b9ba4b..0950a8512 100644 --- a/frontend/src/Components/Controls/UndoControls.tsx +++ b/frontend/src/Components/Controls/UndoControls.tsx @@ -4,7 +4,7 @@ import { } from "@equinor/eds-core-react" import { check_circle_outlined, undo, redo } from "@equinor/eds-icons" import styled from "styled-components" -import { useIsMutating } from "react-query" +import { useIsFetching } from "react-query" import { useParams } from "react-router-dom" import useDataEdits from "../../Hooks/useDataEdits" import { useCaseContext } from "../../Context/CaseContext" @@ -30,14 +30,14 @@ const UndoControls: React.FC = () => { } = useCaseContext() const { caseId } = useParams() - const isMutating = useIsMutating() + const isFetching = useIsFetching() const { undoEdit, redoEdit } = useDataEdits() const currentEditId = getCurrentEditId(editIndexes, caseId) const canUndo = () => { - if (isMutating) { + if (isFetching) { return false } if (!currentEditId || !caseEditsBelongingToCurrentCase) { @@ -49,7 +49,7 @@ const UndoControls: React.FC = () => { } const canRedo = () => { - if (isMutating) { + if (isFetching) { return false } @@ -74,10 +74,10 @@ const UndoControls: React.FC = () => { } useEffect(() => { - if (isMutating) { + if (isFetching) { startCountDown() } - }, [isMutating]) + }, [isFetching]) useEffect(() => { const handleKeyDown = (event: KeyboardEvent) => { @@ -126,7 +126,8 @@ const UndoControls: React.FC = () => { ) } - {/* comment out for qa release + {/* comment out for qa release */} +