<?php
// src/Domain/Catalog/Entities/Product.php
namespace App\Domain\Catalog\Entities;
final class Product
{
private int $m_productprice_id;
private int $m_product_id;
private int $m_pricelist_version_id;
private int $sm_marca_id;
private string $code;
private string $sku;
private string $name;
private float $price;
private float $price_list;
private float $price_std;
private float $price_limit;
private float $price_promo;
private ?string $description;
private ?string $brand = null;
private ?string $imagePath;// opcional (ruta local o URL)
private string $category;
private int $qty;
private int $qty_arrive;
private ?string $comercialname;
private ?string $allegation;
public function __construct(
int $m_productprice_id,
int $m_product_id,
int $m_pricelist_version_id,
int $sm_marca_id,
string $code,
string $sku,
string $name,
float $price,
float $price_list,
float $price_std,
float $price_limit,
float $price_promo,
?string $description,
?string $brand = null,
?string $imagePath,// opcional (ruta local o URL)
string $category,
int $qty,
int $qty_arrive,
?string $comercialname,
?string $allegation
) {
$this->m_productprice_id = $m_productprice_id;
$this->m_product_id = $m_product_id;
$this->m_pricelist_version_id = $m_pricelist_version_id;
$this->sm_marca_id = $sm_marca_id;
$this->code = $code;
$this->sku = $sku;
$this->name = $name;
$this->price = $price;
$this->price_list = $price_list;
$this->price_std = $price_std;
$this->price_limit = $price_limit;
$this->price_promo = $price_promo;
$this->description = $description;
$this->brand = $brand;
$this->imagePath = $imagePath;
$this->category = $category;
$this->qty = $qty;
$this->qty_arrive = $qty_arrive;
$this->comercialname = $comercialname;
$this->allegation = $allegation;
}
public function getMProductId(): int { return $this->m_product_id; }
public function getMPricelistVersionId(): int { return $this->m_pricelist_version_id; }
public function getMProductPriceId(): ?int { return $this->m_productprice_id; }
public function getSmMarcaId(): ?int { return $this->sm_marca_id; }
public function getCode(): ?string { return $this->code; }
public function getSku(): ?string { return $this->sku; }
public function getName(): ?string { return $this->name; }
public function getPrice(): float { return $this->price; }
public function getPriceList(): float { return $this->price_list; }
public function getPriceLimit(): float { return $this->price_limit; }
public function getPricePromo(): float { return $this->price_promo; }
public function getDescription(): string { return $this->description; }
public function getBrand(): ?string { return $this->brand; }
public function getCategory(): ?string { return $this->category; }
public function getImagePath(): string { return $this->imagePath; }
public function getQty(): ?int { return $this->qty; }
public function getQtyArrive(): ?int { return $this->qty_arrive; }
public function getQtyTotal(): ?int { return $this->qty + $this->qty_arrive; }
public function getImage(): string {
return $this->imagePath ?? '';
}
public function getComercialName() : string {
return $this->comercialname ?? '*';
}
public function getAllegation() : string {
if (!$this->allegation){
return "Sin datos";
}
return $this->allegation;
}
}