<?php
declare(strict_types=1);
namespace App\Domain\Site\Model;
use App\Domain\Merchant\Model\Merchant;
use App\Domain\Payment\Model\Payment;
use App\Domain\PaymentGateway\Model\PaymentGatewayConfig;
use App\Domain\Shared\Model\TimestampTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Uid\Uuid;
class Site implements UserInterface, PasswordAuthenticatedUserInterface
{
use TimestampTrait;
/**
* @var Collection<array-key, Payment>
*/
private Collection $payments;
public function __construct(
private Uuid $id,
private Merchant $merchant,
private PaymentGatewayConfig $paymentGatewayConfig,
private BillingInformation $billingInformation,
private string $password,
private string $name,
private string $description,
private bool $active,
private string $secret,
) {
$this->payments = new ArrayCollection();
$this->createdAt = new \DateTimeImmutable();
$this->updatedAt = null;
}
public function getCreatedAt(): \DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeImmutable $createdAt): void
{
$this->createdAt = $createdAt;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt): void
{
$this->updatedAt = $updatedAt;
}
public function getId(): Uuid
{
return $this->id;
}
public function setId(Uuid $id): void
{
$this->id = $id;
}
public function getMerchant(): Merchant
{
return $this->merchant;
}
public function setMerchant(Merchant $merchant): void
{
$this->merchant = $merchant;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): void
{
$this->name = $name;
}
public function getDescription(): string
{
return $this->description;
}
public function setDescription(string $description): void
{
$this->description = $description;
}
public function isActive(): bool
{
return $this->active;
}
public function setActive(bool $active): void
{
$this->active = $active;
}
public function getSecret(): string
{
return $this->secret;
}
public function setSecret(string $secret): void
{
$this->secret = $secret;
}
public function getPassword(): string
{
return $this->password;
}
public function setPassword(string $password): void
{
$this->password = $password;
}
public function getRoles(): array
{
return [SiteRole::SITE->value];
}
public function eraseCredentials() {}
public function getUserIdentifier(): string
{
return (string) $this->id;
}
public function getPaymentGatewayConfig(): PaymentGatewayConfig
{
return $this->paymentGatewayConfig;
}
public function setPaymentGatewayConfig(PaymentGatewayConfig $paymentGatewayConfig): void
{
$this->paymentGatewayConfig = $paymentGatewayConfig;
}
public function getBillingInformation(): BillingInformation
{
return $this->billingInformation;
}
public function setBillingInformation(BillingInformation $billingInformation): void
{
$this->billingInformation = $billingInformation;
}
}