// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using TaxPayer.Infrastructure.Persistence;

#nullable disable

namespace Back.Migrations
{
    [DbContext(typeof(SqlDbContext))]
    [Migration("20250125085346_invoicetb")]
    partial class invoicetb
    {
        /// <inheritdoc />
        protected override void BuildTargetModel(ModelBuilder modelBuilder)
        {
#pragma warning disable 612, 618
            modelBuilder
                .HasAnnotation("ProductVersion", "7.0.15")
                .HasAnnotation("Relational:MaxIdentifierLength", 128);

            SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);

            modelBuilder.Entity("Back.Data.Models.BillType", b =>
                {
                    b.Property<int>("ID")
                        .HasColumnType("int");

                    b.Property<string>("Dec")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("inty")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.ToTable("BillTypes");
                });

            modelBuilder.Entity("Back.Data.Models.Blog", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("DescriptionTag")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("PageTitle")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Photo")
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("Status")
                        .HasColumnType("bit");

                    b.Property<string>("Tags")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Text")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Time")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("keywordsTag")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Blogs");
                });

            modelBuilder.Entity("Back.Data.Models.CODItem", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CompanyID")
                        .HasColumnType("int");

                    b.Property<bool>("IsDeleted")
                        .HasColumnType("bit");

                    b.Property<string>("ItemTaxID")
                        .HasMaxLength(13)
                        .HasColumnType("nvarchar(13)");

                    b.Property<int>("TaxRate")
                        .HasColumnType("int");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("UnitID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("CompanyID");

                    b.HasIndex("UnitID");

                    b.ToTable("CODItems");
                });

            modelBuilder.Entity("Back.Data.Models.CODUnit", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("UnitTaxID")
                        .HasMaxLength(8)
                        .HasColumnType("nvarchar(8)");

                    b.HasKey("ID");

                    b.ToTable("CODUnits");
                });

            modelBuilder.Entity("Back.Data.Models.CalculationType", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("CalculationTypes");
                });

            modelBuilder.Entity("Back.Data.Models.Coding", b =>
                {
                    b.Property<int>("FildID")
                        .HasColumnType("int");

                    b.Property<string>("Code")
                        .HasColumnType("varchar(10)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("FildID", "Code");

                    b.ToTable("Codings");
                });

            modelBuilder.Entity("Back.Data.Models.Company", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("BranchID")
                        .HasColumnType("nvarchar(max)");

                    b.Property<decimal>("Credit")
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("EconomicCode")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Email")
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("IsActive")
                        .HasColumnType("bit");

                    b.Property<byte[]>("Logo")
                        .HasColumnType("varbinary(max)");

                    b.Property<string>("Mobile")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Phone")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("PrivateKey")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("RegisterDate")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("UniqeMemory")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Companies");
                });

            modelBuilder.Entity("Back.Data.Models.CreditDocuments", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CompanyID")
                        .HasColumnType("int");

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<decimal>("Value")
                        .HasColumnType("decimal(18,2)");

                    b.Property<int>("type")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("CompanyID");

                    b.ToTable("CreditDocuments");
                });

            modelBuilder.Entity("Back.Data.Models.Customer", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Address")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("BranchID")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)");

                    b.Property<int>("CompanyID")
                        .HasColumnType("int");

                    b.Property<int>("CustomerType")
                        .HasColumnType("int");

                    b.Property<string>("EconomicCode")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Email")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("FullName")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Info")
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("IsDeleted")
                        .HasColumnType("bit");

                    b.Property<string>("MeliCode")
                        .HasMaxLength(14)
                        .HasColumnType("nvarchar(14)");

                    b.Property<string>("PassportNumber")
                        .HasMaxLength(9)
                        .HasColumnType("nvarchar(9)");

                    b.Property<string>("Phone")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ZipCode")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)");

                    b.HasKey("ID");

                    b.HasIndex("CompanyID");

                    b.ToTable("Customers");
                });

            modelBuilder.Entity("Back.Data.Models.Fild", b =>
                {
                    b.Property<int>("ID")
                        .HasColumnType("int");

                    b.Property<string>("InputBox")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Filds");
                });

            modelBuilder.Entity("Back.Data.Models.FildMode", b =>
                {
                    b.Property<int>("ID")
                        .HasColumnType("int");

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("FildModes");
                });

            modelBuilder.Entity("Back.Data.Models.FildModeInPattern", b =>
                {
                    b.Property<int>("FildID")
                        .HasColumnType("int");

                    b.Property<int>("PatternID")
                        .HasColumnType("int");

                    b.Property<int>("FildModeID")
                        .HasColumnType("int");

                    b.HasKey("FildID", "PatternID", "FildModeID");

                    b.HasIndex("FildModeID");

                    b.HasIndex("PatternID");

                    b.ToTable("FildModeInPattern");
                });

            modelBuilder.Entity("Back.Data.Models.Invoice", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int?>("BillReference")
                        .HasColumnType("int");

                    b.Property<string>("Cdate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<int?>("CompanyID")
                        .HasColumnType("int");

                    b.Property<string>("CottageDateOfCustomsDeclaration")
                        .HasMaxLength(5)
                        .HasColumnType("nvarchar(5)");

                    b.Property<int>("CustomerID")
                        .HasColumnType("int");

                    b.Property<string>("DateSaleAnnouncement")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Des")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("InvoicIssueDate")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("InvoiceDate")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("IsDeleted")
                        .HasColumnType("bit");

                    b.Property<int>("LastChangeUserID")
                        .HasColumnType("int");

                    b.Property<int?>("PatternID")
                        .HasColumnType("int");

                    b.Property<bool>("PreparedtoSendtoTax")
                        .HasColumnType("bit");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Udate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("asn")
                        .HasMaxLength(20)
                        .HasColumnType("nvarchar(20)");

                    b.Property<string>("billid")
                        .HasMaxLength(19)
                        .HasColumnType("nvarchar(19)");

                    b.Property<string>("cdcn")
                        .HasMaxLength(14)
                        .HasColumnType("nvarchar(14)");

                    b.Property<string>("cno")
                        .HasMaxLength(20)
                        .HasColumnType("nvarchar(20)");

                    b.Property<string>("crn")
                        .HasMaxLength(12)
                        .HasColumnType("nvarchar(12)");

                    b.Property<string>("dci")
                        .HasMaxLength(5)
                        .HasColumnType("nvarchar(5)");

                    b.Property<string>("dco")
                        .HasMaxLength(3)
                        .HasColumnType("nvarchar(3)");

                    b.Property<string>("did")
                        .HasMaxLength(12)
                        .HasColumnType("nvarchar(12)");

                    b.Property<int?>("ft")
                        .HasMaxLength(9)
                        .HasColumnType("int");

                    b.Property<string>("inno")
                        .HasMaxLength(10)
                        .HasColumnType("nvarchar(10)");

                    b.Property<string>("ino")
                        .HasMaxLength(18)
                        .HasColumnType("nvarchar(18)");

                    b.Property<decimal?>("insp")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<int>("invoiceType")
                        .HasColumnType("int");

                    b.Property<string>("irno")
                        .HasMaxLength(18)
                        .HasColumnType("nvarchar(18)");

                    b.Property<string>("irtaxid")
                        .HasMaxLength(22)
                        .HasColumnType("nvarchar(22)");

                    b.Property<int?>("lt")
                        .HasColumnType("int");

                    b.Property<string>("oci")
                        .HasMaxLength(5)
                        .HasColumnType("nvarchar(5)");

                    b.Property<string>("ocu")
                        .HasMaxLength(3)
                        .HasColumnType("nvarchar(3)");

                    b.Property<string>("rid")
                        .HasMaxLength(12)
                        .HasColumnType("nvarchar(12)");

                    b.Property<string>("scc")
                        .HasMaxLength(5)
                        .HasColumnType("nvarchar(5)");

                    b.Property<string>("scln")
                        .HasMaxLength(14)
                        .HasColumnType("nvarchar(14)");

                    b.Property<int?>("setm")
                        .HasMaxLength(1)
                        .HasColumnType("int");

                    b.Property<string>("seventeentax")
                        .HasMaxLength(18)
                        .HasColumnType("nvarchar(18)");

                    b.Property<string>("taxid")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("tid")
                        .HasMaxLength(12)
                        .HasColumnType("nvarchar(12)");

                    b.Property<string>("tinc")
                        .HasMaxLength(14)
                        .HasColumnType("nvarchar(14)");

                    b.HasKey("ID");

                    b.HasIndex("BillReference");

                    b.HasIndex("CompanyID");

                    b.HasIndex("CustomerID");

                    b.HasIndex("LastChangeUserID");

                    b.HasIndex("PatternID");

                    b.ToTable("Invoices");
                });

            modelBuilder.Entity("Back.Data.Models.InvoiceItem", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CODID")
                        .HasColumnType("int");

                    b.Property<int?>("InvoiceID")
                        .HasColumnType("int");

                    b.Property<decimal?>("_cfee")
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("am")
                        .HasMaxLength(36)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("bros")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("bsrn")
                        .HasMaxLength(12)
                        .HasColumnType("nvarchar(12)");

                    b.Property<decimal?>("consfee")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("cpr")
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("cui")
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("cut")
                        .HasMaxLength(4)
                        .HasColumnType("nvarchar(4)");

                    b.Property<decimal?>("dis")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("exr")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("fee")
                        .HasMaxLength(36)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("nw")
                        .HasMaxLength(23)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("odam")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("odr")
                        .HasMaxLength(5)
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("odt")
                        .HasMaxLength(255)
                        .HasColumnType("nvarchar(255)");

                    b.Property<decimal?>("olam")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("olr")
                        .HasMaxLength(5)
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("olt")
                        .HasMaxLength(255)
                        .HasColumnType("nvarchar(255)");

                    b.Property<decimal?>("pspd")
                        .HasColumnType("decimal(18,2)");

                    b.Property<long?>("sovat")
                        .HasColumnType("bigint");

                    b.Property<decimal?>("spro")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("sscv")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("ssrv")
                        .HasMaxLength(18)
                        .HasColumnType("decimal(18,2)");

                    b.Property<decimal?>("vra")
                        .HasMaxLength(5)
                        .HasColumnType("decimal(18,2)");

                    b.HasKey("ID");

                    b.HasIndex("CODID");

                    b.HasIndex("InvoiceID");

                    b.ToTable("InvoiceItems");
                });

            modelBuilder.Entity("Back.Data.Models.InvoicePayment", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("InvoiceID")
                        .HasColumnType("int");

                    b.Property<string>("PaymentDateTime")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("acn")
                        .HasMaxLength(14)
                        .HasColumnType("nvarchar(14)");

                    b.Property<string>("iinn")
                        .HasMaxLength(9)
                        .HasColumnType("nvarchar(9)");

                    b.Property<string>("pcn")
                        .HasMaxLength(16)
                        .HasColumnType("nvarchar(16)");

                    b.Property<string>("pid")
                        .HasMaxLength(12)
                        .HasColumnType("nvarchar(12)");

                    b.Property<int?>("pmt")
                        .HasMaxLength(2)
                        .HasColumnType("int");

                    b.Property<long?>("pv")
                        .HasMaxLength(18)
                        .HasColumnType("bigint");

                    b.Property<string>("trmn")
                        .HasMaxLength(8)
                        .HasColumnType("nvarchar(8)");

                    b.Property<string>("trn")
                        .HasMaxLength(14)
                        .HasColumnType("nvarchar(14)");

                    b.HasKey("ID");

                    b.HasIndex("InvoiceID");

                    b.ToTable("InvoicePayments");
                });

            modelBuilder.Entity("Back.Data.Models.InvoiceStatusChang", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("FromStatus")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int?>("InvoiceID")
                        .HasColumnType("int");

                    b.Property<string>("ToStatus")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int?>("UserID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("InvoiceID");

                    b.HasIndex("UserID");

                    b.ToTable("InvoiceStatusChangs");
                });

            modelBuilder.Entity("Back.Data.Models.Notification", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ForUser")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Message")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("Type")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.ToTable("Notifications");
                });

            modelBuilder.Entity("Back.Data.Models.Order", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("ApprovalDate")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("CompanyID")
                        .HasColumnType("int");

                    b.Property<string>("DateCreate")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("Status")
                        .HasColumnType("int");

                    b.Property<decimal>("TDiscount")
                        .HasColumnType("decimal(18,2)");

                    b.Property<int>("UserID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("CompanyID");

                    b.HasIndex("UserID");

                    b.ToTable("Orders");
                });

            modelBuilder.Entity("Back.Data.Models.OrderDiscountCode", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("Code")
                        .HasColumnType("int");

                    b.Property<bool>("Status")
                        .HasColumnType("bit");

                    b.Property<int>("Val")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.ToTable("OrderDiscountCodes");
                });

            modelBuilder.Entity("Back.Data.Models.OrderItem", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<decimal>("APrice")
                        .HasColumnType("decimal(18,2)");

                    b.Property<int>("CreditAmount")
                        .HasColumnType("int");

                    b.Property<decimal>("Discount")
                        .HasColumnType("decimal(18,2)");

                    b.Property<int>("OrderID")
                        .HasColumnType("int");

                    b.Property<int?>("PermissionID")
                        .HasColumnType("int");

                    b.Property<int?>("PromotionID")
                        .HasColumnType("int");

                    b.Property<decimal>("Tax")
                        .HasColumnType("decimal(18,2)");

                    b.HasKey("ID");

                    b.HasIndex("OrderID");

                    b.HasIndex("PermissionID");

                    b.HasIndex("PromotionID");

                    b.ToTable("OrderItems");
                });

            modelBuilder.Entity("Back.Data.Models.Pattern", b =>
                {
                    b.Property<int>("ID")
                        .HasColumnType("int");

                    b.Property<int>("BillTypeID")
                        .HasColumnType("int");

                    b.Property<string>("Dec")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("Status")
                        .HasColumnType("bit");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("inp")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("BillTypeID");

                    b.ToTable("Patterns");
                });

            modelBuilder.Entity("Back.Data.Models.Permission", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("ParentID")
                        .HasColumnType("int");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Permissions");
                });

            modelBuilder.Entity("Back.Data.Models.PermissionPeriod", b =>
                {
                    b.Property<int>("CompanyID")
                        .HasColumnType("int");

                    b.Property<int>("PermissionID")
                        .HasColumnType("int");

                    b.Property<int>("CalculationTypeID")
                        .HasColumnType("int");

                    b.Property<bool?>("IsLocked")
                        .HasColumnType("bit");

                    b.Property<int>("RemainingAmount")
                        .HasColumnType("int");

                    b.Property<int>("TotalAmount")
                        .HasColumnType("int");

                    b.HasKey("CompanyID", "PermissionID", "CalculationTypeID");

                    b.HasIndex("CalculationTypeID");

                    b.HasIndex("PermissionID");

                    b.ToTable("PermissionPeriods");
                });

            modelBuilder.Entity("Back.Data.Models.PermissionUser", b =>
                {
                    b.Property<int>("PermissionID")
                        .HasColumnType("int");

                    b.Property<int>("RolUserID")
                        .HasColumnType("int");

                    b.HasKey("PermissionID", "RolUserID");

                    b.HasIndex("RolUserID");

                    b.ToTable("PermissionUsers");
                });

            modelBuilder.Entity("Back.Data.Models.Pricing", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CalculationTypeID")
                        .HasColumnType("int");

                    b.Property<int>("PermissionID")
                        .HasColumnType("int");

                    b.Property<decimal>("Price")
                        .HasColumnType("decimal(18,2)");

                    b.HasKey("ID");

                    b.HasIndex("CalculationTypeID");

                    b.HasIndex("PermissionID");

                    b.ToTable("Pricing");
                });

            modelBuilder.Entity("Back.Data.Models.Promotion", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Name")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("Status")
                        .HasColumnType("bit");

                    b.HasKey("ID");

                    b.ToTable("Promotions");
                });

            modelBuilder.Entity("Back.Data.Models.PromotionDetails", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<decimal>("APrice")
                        .HasColumnType("decimal(18,2)");

                    b.Property<int>("CreditAmount")
                        .HasColumnType("int");

                    b.Property<int>("PermissionID")
                        .HasColumnType("int");

                    b.Property<int>("PromotionID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("PermissionID");

                    b.HasIndex("PromotionID");

                    b.ToTable("PromotionDetails");
                });

            modelBuilder.Entity("Back.Data.Models.Question", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Answer")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("QuestionCategoryID")
                        .HasColumnType("int");

                    b.Property<bool>("Status")
                        .HasColumnType("bit");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.HasIndex("QuestionCategoryID");

                    b.ToTable("Questions");
                });

            modelBuilder.Entity("Back.Data.Models.QuestionCategory", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("QuestionCategories");
                });

            modelBuilder.Entity("Back.Data.Models.RolUser", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CompanyID")
                        .HasColumnType("int");

                    b.Property<bool>("IsAdmin")
                        .HasColumnType("bit");

                    b.Property<int>("UserID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("CompanyID");

                    b.HasIndex("UserID");

                    b.ToTable("RolUsers");
                });

            modelBuilder.Entity("Back.Data.Models.SaleLead", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Key")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Mobile")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("cn")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("company")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("csr")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("sn")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("SaleLeads");
                });

            modelBuilder.Entity("Back.Data.Models.SentTax", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ErrorsModel")
                        .HasColumnType("nvarchar(MAX)");

                    b.Property<string>("InquiryResultModel")
                        .HasColumnType("nvarchar(MAX)");

                    b.Property<int>("InvoiceID")
                        .HasColumnType("int");

                    b.Property<string>("InvoiceModel")
                        .IsRequired()
                        .HasColumnType("nvarchar(MAX)");

                    b.Property<int>("InvoiceType")
                        .HasColumnType("int");

                    b.Property<string>("ReferenceNumber")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ResponseModel")
                        .HasColumnType("nvarchar(MAX)");

                    b.Property<int>("SentStatus")
                        .HasColumnType("int");

                    b.Property<string>("Time")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("uId")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.HasIndex("InvoiceID");

                    b.ToTable("SentTax");
                });

            modelBuilder.Entity("Back.Data.Models.SpecialCondition", b =>
                {
                    b.Property<int>("FildID")
                        .HasColumnType("int");

                    b.Property<string>("condition")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasIndex("FildID");

                    b.ToTable("SpecialConditions");
                });

            modelBuilder.Entity("Back.Data.Models.SubTicket", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Text")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("TicketID")
                        .HasColumnType("int");

                    b.Property<string>("Time")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("Type")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.HasIndex("TicketID");

                    b.ToTable("SubTickets");
                });

            modelBuilder.Entity("Back.Data.Models.TiceketUnknownPeople", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("FullName")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Mobile")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("TiceketUnknownPeoples");
                });

            modelBuilder.Entity("Back.Data.Models.Ticket", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("CompanyIDOrMobile")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("CreateDate")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("CreateTime")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("EndDate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("EndTime")
                        .HasColumnType("nvarchar(max)");

                    b.Property<int>("Status")
                        .HasColumnType("int");

                    b.Property<string>("Title")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Tickets");
                });

            modelBuilder.Entity("Back.Data.Models.Ulr", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Ip")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Time")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Ulrs");
                });

            modelBuilder.Entity("Back.Data.Models.User", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("DateLastLogin")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Email")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Fullname")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("IsActive")
                        .HasColumnType("bit");

                    b.Property<string>("Mobile")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Password")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<byte[]>("Photo")
                        .HasColumnType("varbinary(max)");

                    b.Property<string>("Token")
                        .HasColumnType("varchar(max)");

                    b.Property<string>("Username")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Users");
                });

            modelBuilder.Entity("Back.Data.Models.UserNotfi", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("NotificationID")
                        .HasColumnType("int");

                    b.Property<int>("UserID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.ToTable("UserNotifis");
                });

            modelBuilder.Entity("Back.Data.Models.VerificationCode", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("Code")
                        .HasColumnType("int");

                    b.Property<string>("Type")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("prm")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("val")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("VerificationCodes");
                });

            modelBuilder.Entity("Back.Data.Models.Warehouse.Receipt", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CODID")
                        .HasColumnType("int");

                    b.Property<decimal>("Count")
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit");

                    b.Property<bool>("ForSale")
                        .HasColumnType("bit");

                    b.Property<int?>("InvoiceID")
                        .HasColumnType("int");

                    b.Property<int>("Type")
                        .HasColumnType("int");

                    b.Property<string>("info")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.HasIndex("CODID");

                    b.ToTable("Receipts");
                });

            modelBuilder.Entity("Back.Data.Models.Warehouse.Remittance", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CODID")
                        .HasColumnType("int");

                    b.Property<decimal>("Count")
                        .HasColumnType("decimal(18,2)");

                    b.Property<string>("Date")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.Property<bool>("Deleted")
                        .HasColumnType("bit");

                    b.Property<int?>("InvoiceID")
                        .HasColumnType("int");

                    b.Property<int>("Type")
                        .HasColumnType("int");

                    b.Property<string>("info")
                        .IsRequired()
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.HasIndex("CODID");

                    b.ToTable("Remittances");
                });

            modelBuilder.Entity("Back.Data.Models.rptQueue", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<int>("CompanyID")
                        .HasColumnType("int");

                    b.Property<int>("InvoicID")
                        .HasColumnType("int");

                    b.HasKey("ID");

                    b.ToTable("rptQueue");
                });

            modelBuilder.Entity("Back.Data.Models.stuff", b =>
                {
                    b.Property<int>("ID")
                        .ValueGeneratedOnAdd()
                        .HasColumnType("int");

                    SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ID"));

                    b.Property<string>("CID")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("DescriptionOfID")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("ExpirationDate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("RunDate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("SpecialOrGeneral")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("TaxableOrFree")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("Vat")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("VatCustomPurposes")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("sDate")
                        .HasColumnType("nvarchar(max)");

                    b.Property<string>("sType")
                        .HasColumnType("nvarchar(max)");

                    b.HasKey("ID");

                    b.ToTable("Stuffs");
                });

            modelBuilder.Entity("Back.Data.Models.CODItem", b =>
                {
                    b.HasOne("Back.Data.Models.Company", "Company")
                        .WithMany("CODItemS")
                        .HasForeignKey("CompanyID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.CODUnit", "CODUnit")
                        .WithMany("CODItemS")
                        .HasForeignKey("UnitID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("CODUnit");

                    b.Navigation("Company");
                });

            modelBuilder.Entity("Back.Data.Models.Coding", b =>
                {
                    b.HasOne("Back.Data.Models.Fild", "Fild")
                        .WithMany("Codings")
                        .HasForeignKey("FildID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Fild");
                });

            modelBuilder.Entity("Back.Data.Models.CreditDocuments", b =>
                {
                    b.HasOne("Back.Data.Models.Company", "company")
                        .WithMany("CreditDocuments")
                        .HasForeignKey("CompanyID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("company");
                });

            modelBuilder.Entity("Back.Data.Models.Customer", b =>
                {
                    b.HasOne("Back.Data.Models.Company", "Company")
                        .WithMany("Customers")
                        .HasForeignKey("CompanyID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Company");
                });

            modelBuilder.Entity("Back.Data.Models.FildModeInPattern", b =>
                {
                    b.HasOne("Back.Data.Models.Fild", "Fild")
                        .WithMany("FildModeInPatterns")
                        .HasForeignKey("FildID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.FildMode", "FildMode")
                        .WithMany("FildModeInPatterns")
                        .HasForeignKey("FildModeID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Pattern", "pattern")
                        .WithMany("FildModeInPatterns")
                        .HasForeignKey("PatternID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Fild");

                    b.Navigation("FildMode");

                    b.Navigation("pattern");
                });

            modelBuilder.Entity("Back.Data.Models.Invoice", b =>
                {
                    b.HasOne("Back.Data.Models.Invoice", "invoice")
                        .WithMany("Childinvoice")
                        .HasForeignKey("BillReference");

                    b.HasOne("Back.Data.Models.Company", "company")
                        .WithMany("invoices")
                        .HasForeignKey("CompanyID");

                    b.HasOne("Back.Data.Models.Customer", "Customer")
                        .WithMany()
                        .HasForeignKey("CustomerID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.User", "user")
                        .WithMany()
                        .HasForeignKey("LastChangeUserID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Pattern", "pattern")
                        .WithMany()
                        .HasForeignKey("PatternID");

                    b.Navigation("Customer");

                    b.Navigation("company");

                    b.Navigation("invoice");

                    b.Navigation("pattern");

                    b.Navigation("user");
                });

            modelBuilder.Entity("Back.Data.Models.InvoiceItem", b =>
                {
                    b.HasOne("Back.Data.Models.CODItem", "cODItem")
                        .WithMany("invoiceDetails")
                        .HasForeignKey("CODID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Invoice", "invoice")
                        .WithMany("invoiceDetails")
                        .HasForeignKey("InvoiceID");

                    b.Navigation("cODItem");

                    b.Navigation("invoice");
                });

            modelBuilder.Entity("Back.Data.Models.InvoicePayment", b =>
                {
                    b.HasOne("Back.Data.Models.Invoice", "invoice")
                        .WithMany("payments")
                        .HasForeignKey("InvoiceID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("invoice");
                });

            modelBuilder.Entity("Back.Data.Models.InvoiceStatusChang", b =>
                {
                    b.HasOne("Back.Data.Models.Invoice", "invoice")
                        .WithMany("invoiceStatusChangs")
                        .HasForeignKey("InvoiceID");

                    b.HasOne("Back.Data.Models.User", "user")
                        .WithMany()
                        .HasForeignKey("UserID");

                    b.Navigation("invoice");

                    b.Navigation("user");
                });

            modelBuilder.Entity("Back.Data.Models.Order", b =>
                {
                    b.HasOne("Back.Data.Models.Company", "Company")
                        .WithMany()
                        .HasForeignKey("CompanyID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.User", "User")
                        .WithMany()
                        .HasForeignKey("UserID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Company");

                    b.Navigation("User");
                });

            modelBuilder.Entity("Back.Data.Models.OrderItem", b =>
                {
                    b.HasOne("Back.Data.Models.Order", "Order")
                        .WithMany("OrderItems")
                        .HasForeignKey("OrderID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Permission", "Permission")
                        .WithMany()
                        .HasForeignKey("PermissionID");

                    b.HasOne("Back.Data.Models.Promotion", "Promotion")
                        .WithMany()
                        .HasForeignKey("PromotionID");

                    b.Navigation("Order");

                    b.Navigation("Permission");

                    b.Navigation("Promotion");
                });

            modelBuilder.Entity("Back.Data.Models.Pattern", b =>
                {
                    b.HasOne("Back.Data.Models.BillType", "BillType")
                        .WithMany("Patterns")
                        .HasForeignKey("BillTypeID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("BillType");
                });

            modelBuilder.Entity("Back.Data.Models.PermissionPeriod", b =>
                {
                    b.HasOne("Back.Data.Models.CalculationType", "CalculationType")
                        .WithMany("permissionPeriods")
                        .HasForeignKey("CalculationTypeID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Company", "Company")
                        .WithMany("PermissionPeriods")
                        .HasForeignKey("CompanyID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Permission", "Permission")
                        .WithMany()
                        .HasForeignKey("PermissionID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("CalculationType");

                    b.Navigation("Company");

                    b.Navigation("Permission");
                });

            modelBuilder.Entity("Back.Data.Models.PermissionUser", b =>
                {
                    b.HasOne("Back.Data.Models.Permission", "Permission")
                        .WithMany("RolUsers")
                        .HasForeignKey("PermissionID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.RolUser", "RolUser")
                        .WithMany("rolePermissions")
                        .HasForeignKey("RolUserID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Permission");

                    b.Navigation("RolUser");
                });

            modelBuilder.Entity("Back.Data.Models.Pricing", b =>
                {
                    b.HasOne("Back.Data.Models.CalculationType", "CalculationType")
                        .WithMany()
                        .HasForeignKey("CalculationTypeID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Permission", "Permission")
                        .WithMany()
                        .HasForeignKey("PermissionID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("CalculationType");

                    b.Navigation("Permission");
                });

            modelBuilder.Entity("Back.Data.Models.PromotionDetails", b =>
                {
                    b.HasOne("Back.Data.Models.Permission", "Permission")
                        .WithMany()
                        .HasForeignKey("PermissionID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.Promotion", "Promotion")
                        .WithMany("PromotionDetails")
                        .HasForeignKey("PromotionID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Permission");

                    b.Navigation("Promotion");
                });

            modelBuilder.Entity("Back.Data.Models.Question", b =>
                {
                    b.HasOne("Back.Data.Models.QuestionCategory", "questionCategory")
                        .WithMany("questions")
                        .HasForeignKey("QuestionCategoryID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("questionCategory");
                });

            modelBuilder.Entity("Back.Data.Models.RolUser", b =>
                {
                    b.HasOne("Back.Data.Models.Company", "Company")
                        .WithMany("RolUsers")
                        .HasForeignKey("CompanyID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.HasOne("Back.Data.Models.User", "User")
                        .WithMany("RolUsers")
                        .HasForeignKey("UserID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Company");

                    b.Navigation("User");
                });

            modelBuilder.Entity("Back.Data.Models.SentTax", b =>
                {
                    b.HasOne("Back.Data.Models.Invoice", "invoice")
                        .WithMany("sentTax")
                        .HasForeignKey("InvoiceID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("invoice");
                });

            modelBuilder.Entity("Back.Data.Models.SpecialCondition", b =>
                {
                    b.HasOne("Back.Data.Models.Fild", "Fild")
                        .WithMany()
                        .HasForeignKey("FildID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Fild");
                });

            modelBuilder.Entity("Back.Data.Models.SubTicket", b =>
                {
                    b.HasOne("Back.Data.Models.Ticket", "Ticket")
                        .WithMany("SubTickets")
                        .HasForeignKey("TicketID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("Ticket");
                });

            modelBuilder.Entity("Back.Data.Models.Warehouse.Receipt", b =>
                {
                    b.HasOne("Back.Data.Models.CODItem", "cODItem")
                        .WithMany("Receipts")
                        .HasForeignKey("CODID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("cODItem");
                });

            modelBuilder.Entity("Back.Data.Models.Warehouse.Remittance", b =>
                {
                    b.HasOne("Back.Data.Models.CODItem", "cODItem")
                        .WithMany("Remittances")
                        .HasForeignKey("CODID")
                        .OnDelete(DeleteBehavior.Cascade)
                        .IsRequired();

                    b.Navigation("cODItem");
                });

            modelBuilder.Entity("Back.Data.Models.BillType", b =>
                {
                    b.Navigation("Patterns");
                });

            modelBuilder.Entity("Back.Data.Models.CODItem", b =>
                {
                    b.Navigation("Receipts");

                    b.Navigation("Remittances");

                    b.Navigation("invoiceDetails");
                });

            modelBuilder.Entity("Back.Data.Models.CODUnit", b =>
                {
                    b.Navigation("CODItemS");
                });

            modelBuilder.Entity("Back.Data.Models.CalculationType", b =>
                {
                    b.Navigation("permissionPeriods");
                });

            modelBuilder.Entity("Back.Data.Models.Company", b =>
                {
                    b.Navigation("CODItemS");

                    b.Navigation("CreditDocuments");

                    b.Navigation("Customers");

                    b.Navigation("PermissionPeriods");

                    b.Navigation("RolUsers");

                    b.Navigation("invoices");
                });

            modelBuilder.Entity("Back.Data.Models.Fild", b =>
                {
                    b.Navigation("Codings");

                    b.Navigation("FildModeInPatterns");
                });

            modelBuilder.Entity("Back.Data.Models.FildMode", b =>
                {
                    b.Navigation("FildModeInPatterns");
                });

            modelBuilder.Entity("Back.Data.Models.Invoice", b =>
                {
                    b.Navigation("Childinvoice");

                    b.Navigation("invoiceDetails");

                    b.Navigation("invoiceStatusChangs");

                    b.Navigation("payments");

                    b.Navigation("sentTax");
                });

            modelBuilder.Entity("Back.Data.Models.Order", b =>
                {
                    b.Navigation("OrderItems");
                });

            modelBuilder.Entity("Back.Data.Models.Pattern", b =>
                {
                    b.Navigation("FildModeInPatterns");
                });

            modelBuilder.Entity("Back.Data.Models.Permission", b =>
                {
                    b.Navigation("RolUsers");
                });

            modelBuilder.Entity("Back.Data.Models.Promotion", b =>
                {
                    b.Navigation("PromotionDetails");
                });

            modelBuilder.Entity("Back.Data.Models.QuestionCategory", b =>
                {
                    b.Navigation("questions");
                });

            modelBuilder.Entity("Back.Data.Models.RolUser", b =>
                {
                    b.Navigation("rolePermissions");
                });

            modelBuilder.Entity("Back.Data.Models.Ticket", b =>
                {
                    b.Navigation("SubTickets");
                });

            modelBuilder.Entity("Back.Data.Models.User", b =>
                {
                    b.Navigation("RolUsers");
                });
#pragma warning restore 612, 618
        }
    }
}
