//
using System;
using CartriX.Api;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CartriX.Api.Migrations
{
[DbContext(typeof(AppDbContext))]
[Migration("20260530090239_Init1")]
partial class Init1
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.7");
modelBuilder.Entity("ArticleCartridgeModel", b =>
{
b.Property("SupportedArticlesId")
.HasColumnType("INTEGER");
b.Property("SupportedCartridgeModelsId")
.HasColumnType("INTEGER");
b.HasKey("SupportedArticlesId", "SupportedCartridgeModelsId");
b.HasIndex("SupportedCartridgeModelsId");
b.ToTable("ArticleCartridgeModel");
});
modelBuilder.Entity("CartriX.Api.Entities.Article", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Articles");
});
modelBuilder.Entity("CartriX.Api.Entities.Cartridge", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CountPrinted")
.HasColumnType("INTEGER");
b.Property("DateLastFilling")
.HasColumnType("TEXT");
b.Property("InstalledInPrinterId")
.HasColumnType("INTEGER");
b.Property("ModelId")
.HasColumnType("INTEGER");
b.Property("StatusId")
.HasColumnType("INTEGER");
b.Property("Volume")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("InstalledInPrinterId")
.IsUnique();
b.HasIndex("ModelId");
b.HasIndex("StatusId");
b.ToTable("Cartridges");
});
modelBuilder.Entity("CartriX.Api.Entities.CartridgeModel", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("ManufacturerId")
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("ManufacturerId");
b.ToTable("CartridgeModels");
});
modelBuilder.Entity("CartriX.Api.Entities.CartridgeStatus", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("CartridgeStatuses");
b.HasData(
new
{
Id = 1,
Name = "Установлен"
},
new
{
Id = 2,
Name = "На склаже"
},
new
{
Id = 3,
Name = "На заправке"
},
new
{
Id = 4,
Name = "В очереди на заправку"
},
new
{
Id = 5,
Name = "В ремонте"
});
});
modelBuilder.Entity("CartriX.Api.Entities.CauseFoReplace", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Description")
.IsRequired()
.HasColumnType("TEXT");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("CausesFoReplace");
b.HasData(
new
{
Id = 1,
Description = "Картридж истратил свой тоннер и требует заправки.",
Name = "Закончился"
},
new
{
Id = 2,
Description = "Картридж работает не корректно, оставляет полосы на распечатанной бумаге. \nТребуется диагностика.",
Name = "Полосит"
},
new
{
Id = 3,
Description = "Картридж работает не корректно, тоннер наноситься на бумагу бледно. \nТребуется диагностика.",
Name = "Бледнит>"
});
});
modelBuilder.Entity("CartriX.Api.Entities.Location", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("Locations");
});
modelBuilder.Entity("CartriX.Api.Entities.Manufacturer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property("picturePath")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Manufacturers");
b.HasData(
new
{
Id = 1,
Name = "Неизвестен"
});
});
modelBuilder.Entity("CartriX.Api.Entities.Printer", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("CountPrintedAllTime")
.HasColumnType("INTEGER");
b.Property("IpAddressOrHostname")
.HasColumnType("TEXT");
b.Property("LocationId")
.HasColumnType("INTEGER");
b.Property("ModelId")
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property("OidForQueryCountPrintedAllTime")
.HasColumnType("TEXT");
b.Property("PrintTypeId")
.HasColumnType("INTEGER");
b.Property("PrinterConnetctionTypeId")
.HasColumnType("INTEGER");
b.Property("PrinterStatusId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("LocationId");
b.HasIndex("ModelId");
b.HasIndex("Name")
.IsUnique();
b.HasIndex("PrintTypeId");
b.HasIndex("PrinterConnetctionTypeId");
b.HasIndex("PrinterStatusId");
b.ToTable("Printers");
});
modelBuilder.Entity("CartriX.Api.Entities.PrinterConnetctionType", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("PrinterConnetctionTypes");
b.HasData(
new
{
Id = 1,
Name = "Сетевой"
},
new
{
Id = 2,
Name = "USB"
});
});
modelBuilder.Entity("CartriX.Api.Entities.PrinterModel", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("ManufacturerId")
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property("SupportedArticleId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("ManufacturerId");
b.HasIndex("SupportedArticleId")
.IsUnique();
b.ToTable("PrinterModels");
});
modelBuilder.Entity("CartriX.Api.Entities.PrinterPrintType", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("PrinterPrintTypes");
b.HasData(
new
{
Id = 1,
Name = "Лазерный"
},
new
{
Id = 2,
Name = "Струйный"
});
});
modelBuilder.Entity("CartriX.Api.Entities.PrinterStatus", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Name")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("PrinterStatuses");
b.HasData(
new
{
Id = 1,
Name = "Активный"
},
new
{
Id = 2,
Name = "Недоступен"
},
new
{
Id = 3,
Name = "В ремонте"
});
});
modelBuilder.Entity("CartriX.Api.Entities.RequestToReplaceCartridge", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property("Applocant")
.IsRequired()
.HasColumnType("TEXT");
b.Property("CartridgeInfo")
.IsRequired()
.HasColumnType("TEXT");
b.Property("CauseId")
.HasColumnType("INTEGER");
b.Property("CountCartridgePrinted")
.HasColumnType("INTEGER");
b.Property("DateAnswerRequest")
.HasColumnType("TEXT");
b.Property("DateCreateRequest")
.HasColumnType("TEXT");
b.Property("Executor")
.HasColumnType("TEXT");
b.Property("LocationName")
.IsRequired()
.HasColumnType("TEXT");
b.Property("PrinterInfo")
.IsRequired()
.HasColumnType("TEXT");
b.Property("ReplacedCartridgeId")
.HasColumnType("INTEGER");
b.Property("SignatureBase64Data")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CauseId");
b.ToTable("RequestsToReplaceCartridge");
});
modelBuilder.Entity("ArticleCartridgeModel", b =>
{
b.HasOne("CartriX.Api.Entities.Article", null)
.WithMany()
.HasForeignKey("SupportedArticlesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CartriX.Api.Entities.CartridgeModel", null)
.WithMany()
.HasForeignKey("SupportedCartridgeModelsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CartriX.Api.Entities.Cartridge", b =>
{
b.HasOne("CartriX.Api.Entities.Printer", "InstalledInPrinter")
.WithOne("InstalledCartridge")
.HasForeignKey("CartriX.Api.Entities.Cartridge", "InstalledInPrinterId");
b.HasOne("CartriX.Api.Entities.CartridgeModel", "Model")
.WithMany()
.HasForeignKey("ModelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CartriX.Api.Entities.CartridgeStatus", "Status")
.WithMany()
.HasForeignKey("StatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("InstalledInPrinter");
b.Navigation("Model");
b.Navigation("Status");
});
modelBuilder.Entity("CartriX.Api.Entities.CartridgeModel", b =>
{
b.HasOne("CartriX.Api.Entities.Manufacturer", "Manufacturer")
.WithMany()
.HasForeignKey("ManufacturerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manufacturer");
});
modelBuilder.Entity("CartriX.Api.Entities.Printer", b =>
{
b.HasOne("CartriX.Api.Entities.Location", "Location")
.WithMany("Printers")
.HasForeignKey("LocationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CartriX.Api.Entities.PrinterModel", "Model")
.WithMany()
.HasForeignKey("ModelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CartriX.Api.Entities.PrinterPrintType", "PrintType")
.WithMany()
.HasForeignKey("PrintTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CartriX.Api.Entities.PrinterConnetctionType", "ConnetctionType")
.WithMany()
.HasForeignKey("PrinterConnetctionTypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CartriX.Api.Entities.PrinterStatus", "Status")
.WithMany()
.HasForeignKey("PrinterStatusId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ConnetctionType");
b.Navigation("Location");
b.Navigation("Model");
b.Navigation("PrintType");
b.Navigation("Status");
});
modelBuilder.Entity("CartriX.Api.Entities.PrinterModel", b =>
{
b.HasOne("CartriX.Api.Entities.Manufacturer", "Manufacturer")
.WithMany()
.HasForeignKey("ManufacturerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CartriX.Api.Entities.Article", "SupportedArticle")
.WithOne("SupportedPrinterModel")
.HasForeignKey("CartriX.Api.Entities.PrinterModel", "SupportedArticleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manufacturer");
b.Navigation("SupportedArticle");
});
modelBuilder.Entity("CartriX.Api.Entities.RequestToReplaceCartridge", b =>
{
b.HasOne("CartriX.Api.Entities.CauseFoReplace", "Cause")
.WithMany()
.HasForeignKey("CauseId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cause");
});
modelBuilder.Entity("CartriX.Api.Entities.Article", b =>
{
b.Navigation("SupportedPrinterModel");
});
modelBuilder.Entity("CartriX.Api.Entities.Location", b =>
{
b.Navigation("Printers");
});
modelBuilder.Entity("CartriX.Api.Entities.Printer", b =>
{
b.Navigation("InstalledCartridge");
});
#pragma warning restore 612, 618
}
}
}