diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/ComponentDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/ComponentDataModel.cs
new file mode 100644
index 0000000..0dd1205
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/ComponentDataModel.cs
@@ -0,0 +1,39 @@
+using NorthBridgeContracts.Enums;
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class ComponentDataModel(string id, string componentName, ComponentType componentType, string manufacturerId, double price, bool isDeleted) : IValidation
+{
+ public string Id { get; private set; } = id;
+
+ public string ComponentName { get; private set; } = componentName;
+
+ public ComponentType ComponentType { get; private set; } = componentType;
+
+ public string ManufacturerId { get; private set; } = manufacturerId;
+
+ public double Price { get; private set; } = price;
+
+ public bool IsDeleted { get; private set; } = isDeleted;
+
+ public void Validate()
+ {
+ if (Id.IsEmpty())
+ throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid())
+ throw new ValidationException("The value in the field Id is not a unique identifier");
+ if (ComponentName.IsEmpty())
+ throw new ValidationException("Field ComponentName is empty");
+ if (ComponentType == ComponentType.None)
+ throw new ValidationException("Field ComponentType is empty");
+ if (ManufacturerId.IsEmpty())
+ throw new ValidationException("Field ManufacturerId is empty");
+ if (!ManufacturerId.IsGuid())
+ throw new ValidationException("The value in the field ManufacturerId is not a unique identifier");
+ if (Price <= 0)
+ throw new ValidationException("Field Price is less than or equal to 0");
+ }
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/ComponentHistoryDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/ComponentHistoryDataModel.cs
new file mode 100644
index 0000000..e28e80f
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/ComponentHistoryDataModel.cs
@@ -0,0 +1,24 @@
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class ComponentHistoryDataModel(string componentId, double oldPrice) : IValidation
+{
+ public string ComponentId { get; private set; } = componentId;
+
+ public double OldPrice { get; private set; } = oldPrice; // олд спайс
+
+ public DateTime ChangeDate { get; private set; } = DateTime.UtcNow; // дата изменения цены
+
+ public void Validate()
+ {
+ if (ComponentId.IsEmpty())
+ throw new ValidationException("Field ComponentId is empty");
+ if (!ComponentId.IsGuid())
+ throw new ValidationException("The value in the field ComponentId is not a unique identifier");
+ if (OldPrice <= 0)
+ throw new ValidationException("Field OldPrice is less than or equal to 0");
+ }
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/CustomerDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/CustomerDataModel.cs
new file mode 100644
index 0000000..87dbf5e
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/CustomerDataModel.cs
@@ -0,0 +1,29 @@
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+using System.Text.RegularExpressions;
+using NorthBridgeContracts.Exceptions;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class CustomerDataModel(string id, string fio, string phone, string email, double discountSize) : IValidation
+{
+ public string Id { get; private set; } = id;
+ public string FIO { get; private set; } = fio;
+ public string Phone { get; private set; } = phone;
+ public string Email { get; private set; } = email;
+ public double DiscountSize { get; private set; } = discountSize;
+
+ public void Validate()
+ {
+ if (Id.IsEmpty()) throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid()) throw new ValidationException("Id must be a GUID");
+ if (FIO.IsEmpty()) throw new ValidationException("Field FIO is empty");
+ if (Phone.IsEmpty()) throw new ValidationException("Field Phone is empty");
+
+ var phoneRegex = new Regex(@"^\+7\d{10}$");
+ if (!phoneRegex.IsMatch(Phone)) throw new ValidationException("Invalid phone format");
+
+ if (Email.IsEmpty() || !Email.Contains("@")) throw new ValidationException("Invalid email format");
+ }
+}
+
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/ManufacturerDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/ManufacturerDataModel.cs
new file mode 100644
index 0000000..7cb07a8
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/ManufacturerDataModel.cs
@@ -0,0 +1,26 @@
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class ManufacturerDataModel(string id, string manufacturerName, string?
+prevManufacturerName, string? prevPrevManufacturerName) : IValidation
+{
+ public string Id { get; private set; } = id;
+ public string ManufacturerName { get; private set; } = manufacturerName;
+ public string? PrevManufacturerName { get; private set; } =
+ prevManufacturerName;
+ public string? PrevPrevManufacturerName { get; private set; } =
+ prevPrevManufacturerName;
+ public void Validate()
+ {
+ if (Id.IsEmpty())
+ throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid())
+ throw new ValidationException("The value in the field Id is not a unique identifier");
+ if (ManufacturerName.IsEmpty())
+ throw new ValidationException("Field ManufacturerName isempty");
+ }
+}
+
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/PostDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/PostDataModel.cs
new file mode 100644
index 0000000..d0e0e88
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/PostDataModel.cs
@@ -0,0 +1,44 @@
+using NorthBridgeContracts.Enums;
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class PostDataModel(string id, string postId, string postName, PostType postType, double salary, bool isActual, DateTime changeDate) : IValidation
+{
+ public string Id { get; private set; } = id;
+
+ public string PostId { get; private set; } = postId;
+
+ public string PostName { get; private set; } = postName;
+
+ public PostType PostType { get; private set; } = postType;
+
+ public double Salary { get; private set; } = salary;
+
+ public bool IsActual { get; private set; } = isActual;
+
+ ///
+ /// Когда эта запись была изменена
+ ///
+ public DateTime ChangeDate { get; private set; } = changeDate;
+
+ public void Validate()
+ {
+ if (Id.IsEmpty())
+ throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid())
+ throw new ValidationException("The value in the field Id is not a unique identifier");
+ if (PostId.IsEmpty())
+ throw new ValidationException("Field PostId is empty");
+ if (!PostId.IsGuid())
+ throw new ValidationException("The value in the field PostId is not a unique identifier");
+ if (PostName.IsEmpty())
+ throw new ValidationException("Field PostName is empty");
+ if (PostType == PostType.None)
+ throw new ValidationException("Field PostName is empty");
+ if (Salary <= 0)
+ throw new ValidationException("Field Salary is empty");
+ }
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/SalaryDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/SalaryDataModel.cs
new file mode 100644
index 0000000..76d423b
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/SalaryDataModel.cs
@@ -0,0 +1,25 @@
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+namespace NorthBridgeContracts.DataModels;
+
+public class SalaryDataModel(string workerId, DateTime salaryDate, double workerSalary) : IValidation
+{
+ public string WorkerId { get; private set; } = workerId;
+
+ public DateTime SalaryDate { get; private set; } = salaryDate;
+
+ public double Salary { get; private set; } = workerSalary;
+ public void Validate()
+ {
+ if (WorkerId.IsEmpty())
+ throw new ValidationException("Field WorkerId is empty");
+ if (!WorkerId.IsGuid())
+ throw new ValidationException("The value in the field WorkerId is not a unique identifier");
+ if (Salary <= 0)
+ throw new ValidationException("Field Salary is less than or equal to 0");
+ }
+}
\ No newline at end of file
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/SaleDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/SaleDataModel.cs
new file mode 100644
index 0000000..6fe0b40
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/SaleDataModel.cs
@@ -0,0 +1,37 @@
+using NorthBridgeContracts.Enums;
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class SaleDataModel(string id, string workerId, string? customerId, double sum, DiscountType discountType, double discount, bool isCancel, List products) : IValidation
+{
+ public string Id { get; private set; } = id;
+ public string WorkerId { get; private set; } = workerId;
+ public string? CustomerId { get; private set; } = customerId;
+ public DateTime SaleDate { get; private set; } = DateTime.UtcNow;
+ public double Sum { get; private set; } = sum;
+ public DiscountType DiscountType { get; private set; } = discountType;
+ public double Discount { get; private set; } = discount;
+ public bool IsCancel { get; private set; } = isCancel;
+ public List Products { get; private set; } =
+ products;
+ public void Validate()
+ {
+ if (Id.IsEmpty())
+ throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid())
+ throw new ValidationException("The value in the field Id is not a unique identifier");
+ if (WorkerId.IsEmpty())
+ throw new ValidationException("Field WorkerId is empty");
+ if (!WorkerId.IsGuid())
+ throw new ValidationException("The value in the field WorkerId is not a unique identifier");
+ if (!CustomerId?.IsGuid() ?? !CustomerId?.IsEmpty() ?? false)
+ throw new ValidationException("The value in the field BuyerId is not a unique identifier");
+ if (Sum <= 0)
+ throw new ValidationException("Field Sum is less than or equal to 0");
+ if ((Products?.Count ?? 0) == 0)
+ throw new ValidationException("The sale must include products");
+ }
+}
\ No newline at end of file
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/SaleProductDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/SaleProductDataModel.cs
new file mode 100644
index 0000000..96f7ac8
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/SaleProductDataModel.cs
@@ -0,0 +1,33 @@
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class SaleProductDataModel(string saleId, string productId, int count) : IValidation
+{
+ public string SaleId { get; private set; } = saleId;
+
+ public string ProductId { get; private set; } = productId;
+
+ public int Count { get; private set; } = count;
+
+ public void Validate()
+ {
+ if (SaleId.IsEmpty())
+ throw new ValidationException("Field SaleId is empty");
+ if (!SaleId.IsGuid())
+ throw new ValidationException("The value in the field SaleId is not a unique identifier");
+ if (ProductId.IsEmpty())
+ throw new ValidationException("Field ProductId is empty");
+ if (!ProductId.IsGuid())
+ throw new ValidationException("The value in the field ProductId is not a unique identifier");
+ if (Count <= 0)
+ throw new ValidationException("Field Count is less than or equal to 0");
+ }
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/DataModels/WorkerDataModel.cs b/NorthBridgeProject/NorthBridgeContracts/DataModels/WorkerDataModel.cs
new file mode 100644
index 0000000..551378f
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/DataModels/WorkerDataModel.cs
@@ -0,0 +1,40 @@
+using NorthBridgeContracts.Exceptions;
+using NorthBridgeContracts.Extensions;
+using NorthBridgeContracts.Infrastructure;
+
+namespace NorthBridgeContracts.DataModels;
+
+public class WorkerDataModel(string id, string fio, string postId, DateTime birthDate, DateTime employmentDate, bool isDeleted) : IValidation
+{
+ public string Id { get; private set; } = id;
+
+ public string FIO { get; private set; } = fio;
+
+ public string PostId { get; private set; } = postId;
+
+ public DateTime BirthDate { get; private set; } = birthDate;
+
+ public DateTime EmploymentDate { get; private set; } = employmentDate;
+
+ public bool IsDeleted { get; private set; } = isDeleted; // признак уволился или нет
+
+ public void Validate()
+ {
+ if (Id.IsEmpty())
+ throw new ValidationException("Field Id is empty");
+ if (!Id.IsGuid())
+ throw new ValidationException("The value in the field Id is not a unique identifier");
+ if (FIO.IsEmpty())
+ throw new ValidationException("Field FIO is empty");
+ if (PostId.IsEmpty())
+ throw new ValidationException("Field PostId is empty");
+ if (!PostId.IsGuid())
+ throw new ValidationException("The value in the field PostId is not a unique identifier");
+ if (BirthDate.Date > DateTime.Now.AddYears(-16).Date)
+ throw new ValidationException($"Minors cannot be hired (BirthDate = {BirthDate.ToShortDateString()})");
+ if (EmploymentDate.Date < BirthDate.Date)
+ throw new ValidationException("The date of employment caanot be less than the date of birth");
+ if ((EmploymentDate - BirthDate).TotalDays / 365 < 16)
+ throw new ValidationException($"Minors cannot be hired (EmploymentDate - {EmploymentDate.ToShortDateString()}, BirthDate - {BirthDate.ToShortDateString()})");
+ }
+}
\ No newline at end of file
diff --git a/NorthBridgeProject/NorthBridgeContracts/Enums/ComponentType.cs b/NorthBridgeProject/NorthBridgeContracts/Enums/ComponentType.cs
new file mode 100644
index 0000000..006b010
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/Enums/ComponentType.cs
@@ -0,0 +1,17 @@
+namespace NorthBridgeContracts.Enums;
+
+public enum ComponentType
+{
+ None = 0, // Не указано
+ Motherboard = 1, // Мать
+ Processor = 2, // Процессор
+ Ram = 3, // Оперативка
+ PowerUnit = 4, // БП
+ GraphicsCard = 5, // Видюха
+ SVO = 6, // Система Воздушного Охлаждения (кулеры)
+ SJO = 7, // Система ЖИДкостного Охлаждения
+ Case = 8, // Кейс
+ Storage = 9, // Накопитель (SSD и HDD)
+ Monitor = 10, // Монитор
+ Peripheral = 11 // Периферия (мышки клавы уши, крч I/O Devices)
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/Enums/DiscountType.cs b/NorthBridgeProject/NorthBridgeContracts/Enums/DiscountType.cs
new file mode 100644
index 0000000..ebaa5ff
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/Enums/DiscountType.cs
@@ -0,0 +1,12 @@
+namespace NorthBridgeContracts.Enums;
+
+
+[Flags]
+public enum DiscountType
+{
+ None = 0, // Без скидки
+ SeasonalSale = 1, // Сезонная распродажа
+ LoyaltyProgram = 2, // Программа ноу лоялти ноу роялти
+ BundleDiscount = 4, // Скидка за комплект
+ PromoCode = 8 // Скидка по промокоду
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/Enums/PostType.cs b/NorthBridgeProject/NorthBridgeContracts/Enums/PostType.cs
new file mode 100644
index 0000000..78a6fa8
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/Enums/PostType.cs
@@ -0,0 +1,10 @@
+namespace NorthBridgeContracts.Enums;
+
+public enum PostType
+{
+ None = 0, // Не указано
+ Manager = 1, // Менеджер (административная должность)
+ SalesSpecialist = 2, // Специалист по продажам
+ TechnicalSpecialist = 3, // Технический специалист
+ StockmanDNS = 4 // Кладовщик
+}
\ No newline at end of file
diff --git a/NorthBridgeProject/NorthBridgeContracts/Exceptions/ValidationException.cs b/NorthBridgeProject/NorthBridgeContracts/Exceptions/ValidationException.cs
new file mode 100644
index 0000000..caf2a40
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/Exceptions/ValidationException.cs
@@ -0,0 +1,5 @@
+namespace NorthBridgeContracts.Exceptions;
+
+public class ValidationException(string message) : Exception(message)
+{
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/Extensions/StringExtensions.cs b/NorthBridgeProject/NorthBridgeContracts/Extensions/StringExtensions.cs
new file mode 100644
index 0000000..1b8ab2a
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/Extensions/StringExtensions.cs
@@ -0,0 +1,13 @@
+namespace NorthBridgeContracts.Extensions;
+
+public static class StringExtensions
+{
+ public static bool IsEmpty(this string str)
+ {
+ return string.IsNullOrWhiteSpace(str);
+ }
+ public static bool IsGuid(this string str)
+ {
+ return Guid.TryParse(str, out _);
+ }
+}
diff --git a/NorthBridgeProject/NorthBridgeContracts/Infrastructure/IValidation.cs b/NorthBridgeProject/NorthBridgeContracts/Infrastructure/IValidation.cs
new file mode 100644
index 0000000..31f2d53
--- /dev/null
+++ b/NorthBridgeProject/NorthBridgeContracts/Infrastructure/IValidation.cs
@@ -0,0 +1,6 @@
+namespace NorthBridgeContracts.Infrastructure;
+
+public interface IValidation
+{
+ void Validate();
+}