from django.db import models

class Product(models.Model):
    name = models.CharField(max_length=255)
    manufacturer = models.CharField(max_length=255)
    manufacturer_country = models.CharField(max_length=255)
    manufacturer_code = models.CharField(max_length=50)
    dimensions = models.CharField(max_length=255, null=True, blank=True)
    unit = models.CharField(max_length=50)
    shelf_life = models.IntegerField()  # Срок годности в днях
    barcode = models.CharField(max_length=50)
    additional_info = models.TextField(null=True, blank=True)

class Employee(models.Model):
    full_name = models.CharField(max_length=255)
    passport_series = models.CharField(max_length=10)
    passport_number = models.CharField(max_length=10)
    birth_date = models.DateField()
    position = models.CharField(max_length=255)
    department = models.CharField(max_length=255)
    login = models.CharField(max_length=100, unique=True)
    password = models.CharField(max_length=100)
    role = models.CharField(max_length=100)
    work_phone = models.CharField(max_length=20)
    personal_phone = models.CharField(max_length=20, null=True, blank=True)
    email = models.EmailField()

# Пример дополнительных моделей
class Contractor(models.Model):
    name = models.CharField(max_length=255)
    contract_number = models.CharField(max_length=100)
    address = models.TextField()

class ContractorContact(models.Model):
    contractor = models.ForeignKey(Contractor, on_delete=models.CASCADE, related_name="contacts")
    full_name = models.CharField(max_length=255)
    phone = models.CharField(max_length=20)
    email = models.EmailField()
