from django.db import models
from product_directory.models import Product

class GoodsReception(models.Model):
    product = models.ForeignKey(Product, on_delete=models.CASCADE, verbose_name="Товар")
    quantity = models.PositiveIntegerField(verbose_name="Количество")
    quality_check = models.BooleanField(verbose_name="Проверка качества")
    shelf_life_valid = models.BooleanField(verbose_name="Срок годности соответствует")
    is_accepted = models.BooleanField(verbose_name="Принят", default=False)
    rejection_reason = models.TextField(verbose_name="Причина отклонения", blank=True, null=True)

    def __str__(self):
        return f"Приемка: {self.product.name}"