<?php
namespace App\Entity;
use App\Entity\Generic\User;
use App\Repository\TransactionRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
#[ORM\Entity(repositoryClass: TransactionRepository::class)]
class Transaction extends BaseEntity
{
#[ORM\Id]
#[ORM\Column(type: 'guid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: UuidGenerator::class)]
private ?string $id = null;
#[ORM\ManyToOne(inversedBy: 'transactions')]
#[ORM\JoinColumn(nullable: false)]
private ?User $owner = null;
#[ORM\Column]
private ?int $type = null;
#[ORM\Column]
private ?int $price = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $description = null;
#[ORM\Column]
private ?int $beforeWallet = null;
#[ORM\Column]
private ?int $afterWallet = null;
#[ORM\Column]
private ?bool $mabeByAdmin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $bidFollowCode = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $serviceId = null;
#[ORM\ManyToOne(inversedBy: 'madeTransactions')]
private ?User $author = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $increaseType = null;
#[ORM\Column]
private ?bool $isProfit = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $serviceProtocol = null;
public function getOwnerEmail()
{
return $this->getOwner()->getEmail();
}
public function __construct()
{
parent::__construct();
$this->setMabeByAdmin(0);
$this->setIsProfit(0);
}
public function setMabeByAdmin(bool $mabeByAdmin): self
{
$this->mabeByAdmin = $mabeByAdmin;
return $this;
}
public function getId(): ?string
{
return $this->id;
}
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): self
{
$this->owner = $owner;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
public function getPrice(): ?int
{
return $this->price;
}
public function setPrice(int $price): self
{
$this->price = $price;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
return $this;
}
public function getBeforeWallet(): ?int
{
return $this->beforeWallet;
}
public function setBeforeWallet(int $beforeWallet): self
{
$this->beforeWallet = $beforeWallet;
return $this;
}
public function getAfterWallet(): ?int
{
return $this->afterWallet;
}
public function setAfterWallet(int $afterWallet): self
{
$this->afterWallet = $afterWallet;
return $this;
}
public function isMabeByAdmin(): ?bool
{
return $this->mabeByAdmin;
}
public function getBidFollowCode(): ?string
{
return $this->bidFollowCode;
}
public function setBidFollowCode(?string $bidFollowCode): self
{
$this->bidFollowCode = $bidFollowCode;
return $this;
}
public function getServiceId(): ?string
{
return $this->serviceId;
}
public function setServiceId(?string $serviceId): self
{
$this->serviceId = $serviceId;
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): self
{
$this->author = $author;
return $this;
}
public function getIncreaseType(): ?string
{
return $this->increaseType;
}
public function setIncreaseType(?string $increaseType): self
{
$this->increaseType = $increaseType;
return $this;
}
public function isIsProfit(): ?bool
{
return $this->isProfit;
}
public function setIsProfit(bool $isProfit): self
{
$this->isProfit = $isProfit;
return $this;
}
public function getServiceProtocol(): ?string
{
return $this->serviceProtocol;
}
public function setServiceProtocol(?string $serviceProtocol): self
{
$this->serviceProtocol = $serviceProtocol;
return $this;
}
}