<?php

namespace App\Entity;

use App\Repository\StripeWebhookSecretRepository;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: StripeWebhookSecretRepository::class)]
class StripeWebhookSecret
{
    public const TYPE_MAIN_LIGHT = 'main_light';
    public const TYPE_MAIN_INSTANT = 'main_instant';
    public const TYPE_CONNECT_LIGHT = 'connect_light';
    public const TYPE_CONNECT_INSTANT = 'connect_instant';

    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column]
    private ?int $id = null;

    #[ORM\Column(length: 30, unique: true)]
    private string $type;

    #[ORM\Column(length: 255)]
    private string $secret;

    #[ORM\Column(length: 255, nullable: true)]
    private ?string $endpointId = null;

    #[ORM\Column]
    private \DateTimeImmutable $createdAt;

    public function __construct(string $type, string $secret, ?string $endpointId = null)
    {
        $this->type = $type;
        $this->secret = $secret;
        $this->endpointId = $endpointId;
        $this->createdAt = new \DateTimeImmutable();
    }

    public function getId(): ?int
    {
        return $this->id;
    }

    public function getType(): string
    {
        return $this->type;
    }

    public function getSecret(): string
    {
        return $this->secret;
    }

    public function setSecret(string $secret): void
    {
        $this->secret = $secret;
    }

    public function getEndpointId(): ?string
    {
        return $this->endpointId;
    }

    public function setEndpointId(?string $endpointId): void
    {
        $this->endpointId = $endpointId;
    }

    public function getCreatedAt(): \DateTimeImmutable
    {
        return $this->createdAt;
    }
}
