//
using System;
using App.Infrastructure.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace App.Infrastructure.Data.Migrations
{
[DbContext(typeof(GmaoDbContext))]
[Migration("20260910115542_InitialCreate")]
partial class InitialCreate
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
modelBuilder.Entity("App.Core.Entities.Inventory.MachinePart", b =>
{
b.Property("MachineId")
.HasColumnType("INTEGER");
b.Property("PartId")
.HasColumnType("INTEGER");
b.HasKey("MachineId", "PartId");
b.HasIndex("PartId");
b.ToTable("MachineParts");
});
modelBuilder.Entity("App.Core.Entities.Inventory.Part", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("AlertThreshold")
.HasColumnType("REAL");
b.Property("Designation")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("IsActive")
.HasColumnType("INTEGER");
b.Property("Location")
.HasColumnType("TEXT");
b.Property("PhotoAttachmentId")
.HasColumnType("INTEGER");
b.Property("PrimarySupplierId")
.HasColumnType("INTEGER");
b.Property("QuantityInStock")
.HasColumnType("REAL");
b.Property("Reference")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("UnitPrice")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("PrimarySupplierId");
b.HasIndex("Reference")
.IsUnique();
b.ToTable("Parts");
});
modelBuilder.Entity("App.Core.Entities.Inventory.StockMovement", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property("CreatedByUserId")
.HasColumnType("INTEGER");
b.Property("MovementType")
.HasColumnType("INTEGER");
b.Property("PartId")
.HasColumnType("INTEGER");
b.Property("Quantity")
.HasColumnType("REAL");
b.Property("Reason")
.HasColumnType("TEXT");
b.Property("SupplierInvoiceId")
.HasColumnType("INTEGER");
b.Property("WorkOrderId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PartId", "CreatedAtUtc");
b.ToTable("StockMovements");
});
modelBuilder.Entity("App.Core.Entities.Inventory.Supplier", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Address")
.HasColumnType("TEXT");
b.Property("ContactName")
.HasColumnType("TEXT");
b.Property("Email")
.HasColumnType("TEXT");
b.Property("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("Phone")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Suppliers");
});
modelBuilder.Entity("App.Core.Entities.Invoicing.Invoice", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("ClientAddress")
.HasColumnType("TEXT");
b.Property("ClientName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property("CreatedByUserId")
.HasColumnType("INTEGER");
b.Property("DocumentType")
.HasColumnType("INTEGER");
b.Property("DueDate")
.HasColumnType("TEXT");
b.Property("IssueDate")
.HasColumnType("TEXT");
b.Property("LinkedWorkOrderId")
.HasColumnType("INTEGER");
b.Property("Number")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("PdfAttachmentId")
.HasColumnType("INTEGER");
b.Property("Status")
.HasColumnType("INTEGER");
b.Property("TotalHT")
.HasColumnType("TEXT");
b.Property("TotalTTC")
.HasColumnType("TEXT");
b.Property("VatRate")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Number")
.IsUnique();
b.ToTable("Invoices");
});
modelBuilder.Entity("App.Core.Entities.Invoicing.InvoiceLine", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Designation")
.IsRequired()
.HasMaxLength(300)
.HasColumnType("TEXT");
b.Property("InvoiceId")
.HasColumnType("INTEGER");
b.Property("Order")
.HasColumnType("INTEGER");
b.Property("Quantity")
.HasColumnType("REAL");
b.Property("UnitPrice")
.HasColumnType("TEXT");
b.Property("VatRateOverride")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("InvoiceId");
b.ToTable("InvoiceLines");
});
modelBuilder.Entity("App.Core.Entities.Invoicing.SupplierInvoice", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Amount")
.HasColumnType("TEXT");
b.Property("AttachmentId")
.HasColumnType("INTEGER");
b.Property("ImportedAtUtc")
.HasColumnType("TEXT");
b.Property("InvoiceDate")
.HasColumnType("TEXT");
b.Property("InvoiceNumber")
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property("LinkedWorkOrderId")
.HasColumnType("INTEGER");
b.Property("SupplierId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("SupplierInvoices");
});
modelBuilder.Entity("App.Core.Entities.Licensing.LicenseActivationCache", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CompanyName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("IssuedDate")
.HasColumnType("TEXT");
b.Property("MaxMachines")
.HasColumnType("INTEGER");
b.Property("MaxUsers")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("LicenseActivationCaches");
});
modelBuilder.Entity("App.Core.Entities.Machines.Machine", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CommissioningDate")
.HasColumnType("TEXT");
b.Property("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property("Criticality")
.HasColumnType("INTEGER");
b.Property("Designation")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("IsActive")
.HasColumnType("INTEGER");
b.Property("Location")
.HasColumnType("TEXT");
b.Property("PhotoAttachmentId")
.HasColumnType("INTEGER");
b.Property("Reference")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("UpdatedAtUtc")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Reference")
.IsUnique();
b.ToTable("Machines");
});
modelBuilder.Entity("App.Core.Entities.Machines.MachineCounterReading", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CounterType")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("MachineId")
.HasColumnType("INTEGER");
b.Property("RecordedAtUtc")
.HasColumnType("TEXT");
b.Property("Source")
.HasColumnType("INTEGER");
b.Property("Value")
.HasColumnType("REAL");
b.HasKey("Id");
b.HasIndex("MachineId", "CounterType", "RecordedAtUtc");
b.ToTable("MachineCounterReadings");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenancePlan", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CounterThreshold")
.HasColumnType("REAL");
b.Property("CounterType")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property("CustomIntervalDays")
.HasColumnType("INTEGER");
b.Property("DayOfMonth")
.HasColumnType("INTEGER");
b.Property("DayOfWeek")
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("FrequencyType")
.HasColumnType("INTEGER");
b.Property("IsActive")
.HasColumnType("INTEGER");
b.Property("LastExecutionCounterValue")
.HasColumnType("REAL");
b.Property("LastExecutionDateUtc")
.HasColumnType("TEXT");
b.Property("LeadTimeDays")
.HasColumnType("INTEGER");
b.Property("LeadTimePercentForCounter")
.HasColumnType("REAL");
b.Property("MachineId")
.HasColumnType("INTEGER");
b.Property("MonthlyRuleOccurrence")
.HasColumnType("INTEGER");
b.Property("MonthlyRuleWeekday")
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("RequiredQualificationTypeId")
.HasColumnType("INTEGER");
b.Property("StartDate")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("MachineId", "IsActive");
b.ToTable("MaintenancePlans");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTask", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Description")
.HasColumnType("TEXT");
b.Property("EstimatedDurationMinutes")
.HasColumnType("INTEGER");
b.Property("Label")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("MaintenancePlanId")
.HasColumnType("INTEGER");
b.Property("Order")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("MaintenancePlanId");
b.ToTable("MaintenanceTasks");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTaskPart", b =>
{
b.Property("MaintenanceTaskId")
.HasColumnType("INTEGER");
b.Property("PartId")
.HasColumnType("INTEGER");
b.Property("QuantityRequired")
.HasColumnType("REAL");
b.HasKey("MaintenanceTaskId", "PartId");
b.HasIndex("PartId");
b.ToTable("MaintenanceTaskParts");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.Tool", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Tools");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrder", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("AssignedTechnicianUserId")
.HasColumnType("INTEGER");
b.Property("Comment")
.HasColumnType("TEXT");
b.Property("CompletedAtUtc")
.HasColumnType("TEXT");
b.Property("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property("DueDate")
.HasColumnType("TEXT");
b.Property("GeneratedForOccurrenceKey")
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property("MachineId")
.HasColumnType("INTEGER");
b.Property("MaintenancePlanId")
.HasColumnType("INTEGER");
b.Property("Priority")
.HasColumnType("INTEGER");
b.Property("ScheduledDate")
.HasColumnType("TEXT");
b.Property("Source")
.HasColumnType("INTEGER");
b.Property("Status")
.HasColumnType("INTEGER");
b.Property("Type")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("AssignedTechnicianUserId");
b.HasIndex("MachineId");
b.HasIndex("MaintenancePlanId", "GeneratedForOccurrenceKey")
.IsUnique()
.HasFilter("MaintenancePlanId IS NOT NULL");
b.HasIndex("Status", "ScheduledDate");
b.ToTable("WorkOrders");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderPartUsed", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("PartId")
.HasColumnType("INTEGER");
b.Property("QuantityUsed")
.HasColumnType("REAL");
b.Property("StockMovementId")
.HasColumnType("INTEGER");
b.Property("WorkOrderId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("PartId");
b.HasIndex("WorkOrderId");
b.ToTable("WorkOrderPartsUsed");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderTaskResult", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Comment")
.HasColumnType("TEXT");
b.Property("CompletedAtUtc")
.HasColumnType("TEXT");
b.Property("CompletedByTechnicianUserId")
.HasColumnType("INTEGER");
b.Property("IsCompleted")
.HasColumnType("INTEGER");
b.Property("MaintenanceTaskId")
.HasColumnType("INTEGER");
b.Property("PhotoAttachmentId")
.HasColumnType("INTEGER");
b.Property("WorkOrderId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("MaintenanceTaskId");
b.HasIndex("WorkOrderId");
b.ToTable("WorkOrderTaskResults");
});
modelBuilder.Entity("App.Core.Entities.Shared.AppSetting", b =>
{
b.Property("Key")
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property("Value")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Key");
b.ToTable("AppSettings");
});
modelBuilder.Entity("App.Core.Entities.Shared.Attachment", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("ContentType")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property("EntityId")
.HasColumnType("INTEGER");
b.Property("EntityType")
.HasColumnType("INTEGER");
b.Property("FileName")
.IsRequired()
.HasMaxLength(260)
.HasColumnType("TEXT");
b.Property("SizeBytes")
.HasColumnType("INTEGER");
b.Property("StoredRelativePath")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("TEXT");
b.Property("UploadedAtUtc")
.HasColumnType("TEXT");
b.Property("UploadedByUserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("EntityType", "EntityId");
b.ToTable("Attachments");
});
modelBuilder.Entity("App.Core.Entities.Sync.SyncDevice", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("DeviceIdentifier")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("DeviceName")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property("IsActive")
.HasColumnType("INTEGER");
b.Property("LastSyncAtUtc")
.HasColumnType("TEXT");
b.Property("PairedAtUtc")
.HasColumnType("TEXT");
b.Property("PairingPinHash")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("DeviceIdentifier")
.IsUnique();
b.ToTable("SyncDevices");
});
modelBuilder.Entity("App.Core.Entities.Sync.SyncLogEntry", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Direction")
.HasColumnType("INTEGER");
b.Property("EntityType")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property("ErrorMessage")
.HasColumnType("TEXT");
b.Property("OccurredAtUtc")
.HasColumnType("TEXT");
b.Property("Status")
.HasColumnType("INTEGER");
b.Property("SyncDeviceId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SyncDeviceId");
b.ToTable("SyncLogEntries");
});
modelBuilder.Entity("App.Core.Entities.Team.QualificationType", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Category")
.HasColumnType("INTEGER");
b.Property("Code")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("TEXT");
b.Property("Label")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Code")
.IsUnique();
b.ToTable("QualificationTypes");
});
modelBuilder.Entity("App.Core.Entities.Team.TechnicianProfile", b =>
{
b.Property("UserId")
.HasColumnType("INTEGER");
b.Property("PhoneNumber")
.HasColumnType("TEXT");
b.Property("Skills")
.HasColumnType("TEXT");
b.HasKey("UserId");
b.ToTable("TechnicianProfiles");
});
modelBuilder.Entity("App.Core.Entities.Team.TechnicianQualification", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CertificateAttachmentId")
.HasColumnType("INTEGER");
b.Property("ExpiryDate")
.HasColumnType("TEXT");
b.Property("ObtainedDate")
.HasColumnType("TEXT");
b.Property("QualificationTypeId")
.HasColumnType("INTEGER");
b.Property("TechnicianUserId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("QualificationTypeId");
b.HasIndex("TechnicianUserId", "ExpiryDate");
b.ToTable("TechnicianQualifications");
});
modelBuilder.Entity("App.Core.Entities.Team.TimeEntry", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Comment")
.HasColumnType("TEXT");
b.Property("DurationMinutes")
.HasColumnType("INTEGER");
b.Property("EndedAtUtc")
.HasColumnType("TEXT");
b.Property("Source")
.HasColumnType("INTEGER");
b.Property("StartedAtUtc")
.HasColumnType("TEXT");
b.Property("SyncDeviceId")
.HasColumnType("INTEGER");
b.Property("TechnicianUserId")
.HasColumnType("INTEGER");
b.Property("WorkOrderId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("WorkOrderId");
b.ToTable("TimeEntries");
});
modelBuilder.Entity("App.Core.Entities.Team.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CreatedAtUtc")
.HasColumnType("TEXT");
b.Property("Email")
.HasColumnType("TEXT");
b.Property("FullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property("IsActive")
.HasColumnType("INTEGER");
b.Property("LastLoginAtUtc")
.HasColumnType("TEXT");
b.Property("PasswordHash")
.IsRequired()
.HasColumnType("TEXT");
b.Property("Role")
.HasColumnType("INTEGER");
b.Property("Username")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Username")
.IsUnique();
b.ToTable("Users");
});
modelBuilder.Entity("MaintenanceTaskTool", b =>
{
b.Property("MaintenanceTaskId")
.HasColumnType("INTEGER");
b.Property("ToolsId")
.HasColumnType("INTEGER");
b.HasKey("MaintenanceTaskId", "ToolsId");
b.HasIndex("ToolsId");
b.ToTable("MaintenanceTaskTools", (string)null);
});
modelBuilder.Entity("App.Core.Entities.Inventory.MachinePart", b =>
{
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
.WithMany("MachineParts")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("App.Core.Entities.Inventory.Part", "Part")
.WithMany()
.HasForeignKey("PartId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Machine");
b.Navigation("Part");
});
modelBuilder.Entity("App.Core.Entities.Inventory.Part", b =>
{
b.HasOne("App.Core.Entities.Inventory.Supplier", "PrimarySupplier")
.WithMany()
.HasForeignKey("PrimarySupplierId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("PrimarySupplier");
});
modelBuilder.Entity("App.Core.Entities.Inventory.StockMovement", b =>
{
b.HasOne("App.Core.Entities.Inventory.Part", "Part")
.WithMany()
.HasForeignKey("PartId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Part");
});
modelBuilder.Entity("App.Core.Entities.Invoicing.InvoiceLine", b =>
{
b.HasOne("App.Core.Entities.Invoicing.Invoice", null)
.WithMany("Lines")
.HasForeignKey("InvoiceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("App.Core.Entities.Machines.MachineCounterReading", b =>
{
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
.WithMany("CounterReadings")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Machine");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenancePlan", b =>
{
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
.WithMany("MaintenancePlans")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Machine");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTask", b =>
{
b.HasOne("App.Core.Entities.Maintenance.MaintenancePlan", "MaintenancePlan")
.WithMany("Tasks")
.HasForeignKey("MaintenancePlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MaintenancePlan");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTaskPart", b =>
{
b.HasOne("App.Core.Entities.Maintenance.MaintenanceTask", null)
.WithMany("RequiredParts")
.HasForeignKey("MaintenanceTaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("App.Core.Entities.Inventory.Part", "Part")
.WithMany()
.HasForeignKey("PartId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Part");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrder", b =>
{
b.HasOne("App.Core.Entities.Team.User", null)
.WithMany()
.HasForeignKey("AssignedTechnicianUserId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("App.Core.Entities.Machines.Machine", "Machine")
.WithMany("WorkOrders")
.HasForeignKey("MachineId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("App.Core.Entities.Maintenance.MaintenancePlan", "MaintenancePlan")
.WithMany("WorkOrders")
.HasForeignKey("MaintenancePlanId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Machine");
b.Navigation("MaintenancePlan");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderPartUsed", b =>
{
b.HasOne("App.Core.Entities.Inventory.Part", null)
.WithMany()
.HasForeignKey("PartId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("App.Core.Entities.Maintenance.WorkOrder", null)
.WithMany("PartsUsed")
.HasForeignKey("WorkOrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrderTaskResult", b =>
{
b.HasOne("App.Core.Entities.Maintenance.MaintenanceTask", null)
.WithMany()
.HasForeignKey("MaintenanceTaskId")
.OnDelete(DeleteBehavior.Restrict);
b.HasOne("App.Core.Entities.Maintenance.WorkOrder", "WorkOrder")
.WithMany("TaskResults")
.HasForeignKey("WorkOrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("WorkOrder");
});
modelBuilder.Entity("App.Core.Entities.Sync.SyncLogEntry", b =>
{
b.HasOne("App.Core.Entities.Sync.SyncDevice", null)
.WithMany()
.HasForeignKey("SyncDeviceId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("App.Core.Entities.Team.TechnicianProfile", b =>
{
b.HasOne("App.Core.Entities.Team.User", "User")
.WithOne("TechnicianProfile")
.HasForeignKey("App.Core.Entities.Team.TechnicianProfile", "UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("App.Core.Entities.Team.TechnicianQualification", b =>
{
b.HasOne("App.Core.Entities.Team.QualificationType", "QualificationType")
.WithMany()
.HasForeignKey("QualificationTypeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("App.Core.Entities.Team.TechnicianProfile", "Technician")
.WithMany("Qualifications")
.HasForeignKey("TechnicianUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("QualificationType");
b.Navigation("Technician");
});
modelBuilder.Entity("App.Core.Entities.Team.TimeEntry", b =>
{
b.HasOne("App.Core.Entities.Maintenance.WorkOrder", "WorkOrder")
.WithMany()
.HasForeignKey("WorkOrderId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("WorkOrder");
});
modelBuilder.Entity("MaintenanceTaskTool", b =>
{
b.HasOne("App.Core.Entities.Maintenance.MaintenanceTask", null)
.WithMany()
.HasForeignKey("MaintenanceTaskId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("App.Core.Entities.Maintenance.Tool", null)
.WithMany()
.HasForeignKey("ToolsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("App.Core.Entities.Invoicing.Invoice", b =>
{
b.Navigation("Lines");
});
modelBuilder.Entity("App.Core.Entities.Machines.Machine", b =>
{
b.Navigation("CounterReadings");
b.Navigation("MachineParts");
b.Navigation("MaintenancePlans");
b.Navigation("WorkOrders");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenancePlan", b =>
{
b.Navigation("Tasks");
b.Navigation("WorkOrders");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.MaintenanceTask", b =>
{
b.Navigation("RequiredParts");
});
modelBuilder.Entity("App.Core.Entities.Maintenance.WorkOrder", b =>
{
b.Navigation("PartsUsed");
b.Navigation("TaskResults");
});
modelBuilder.Entity("App.Core.Entities.Team.TechnicianProfile", b =>
{
b.Navigation("Qualifications");
});
modelBuilder.Entity("App.Core.Entities.Team.User", b =>
{
b.Navigation("TechnicianProfile");
});
#pragma warning restore 612, 618
}
}
}