<?php

declare(strict_types=1);

namespace App\Entity;

use App\Repository\EmployeeRttPaymentRepository;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity(repositoryClass: EmployeeRttPaymentRepository::class)]
#[ORM\Table(name: 'employee_rtt_payments', options: ['comment' => 'Paiements RTT par employe, mois et exercice.'])]
#[ORM\Index(columns: ['employee_id', 'year'], name: 'idx_rtt_payment_employee_year')]
class EmployeeRttPayment
{
    #[ORM\Id]
    #[ORM\GeneratedValue]
    #[ORM\Column(type: 'integer')]
    private ?int $id = null;

    #[ORM\ManyToOne(targetEntity: Employee::class)]
    #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
    private ?Employee $employee = null;

    #[ORM\Column(type: 'integer', options: ['comment' => 'Annee d exercice.'])]
    private int $year = 0;

    #[ORM\Column(type: 'integer', options: ['comment' => 'Mois du paiement.'])]
    private int $month = 0;

    #[ORM\Column(type: 'integer', options: ['comment' => 'Base heures palier 25% en minutes.', 'default' => 0])]
    private int $base25Minutes = 0;

    #[ORM\Column(type: 'integer', options: ['comment' => 'Bonus 25% en minutes.', 'default' => 0])]
    private int $bonus25Minutes = 0;

    #[ORM\Column(type: 'integer', options: ['comment' => 'Base heures palier 50% en minutes.', 'default' => 0])]
    private int $base50Minutes = 0;

    #[ORM\Column(type: 'integer', options: ['comment' => 'Bonus 50% en minutes.', 'default' => 0])]
    private int $bonus50Minutes = 0;

    #[ORM\Column(type: 'datetime_immutable')]
    private DateTimeImmutable $createdAt;

    #[ORM\Column(type: 'datetime_immutable')]
    private DateTimeImmutable $updatedAt;

    public function __construct()
    {
        $now             = new DateTimeImmutable();
        $this->createdAt = $now;
        $this->updatedAt = $now;
    }

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

    public function getEmployee(): ?Employee
    {
        return $this->employee;
    }

    public function setEmployee(Employee $employee): self
    {
        $this->employee = $employee;

        return $this;
    }

    public function getYear(): int
    {
        return $this->year;
    }

    public function setYear(int $year): self
    {
        $this->year = $year;

        return $this;
    }

    public function getMonth(): int
    {
        return $this->month;
    }

    public function setMonth(int $month): self
    {
        $this->month = $month;

        return $this;
    }

    public function getBase25Minutes(): int
    {
        return $this->base25Minutes;
    }

    public function setBase25Minutes(int $base25Minutes): self
    {
        $this->base25Minutes = $base25Minutes;

        return $this;
    }

    public function getBonus25Minutes(): int
    {
        return $this->bonus25Minutes;
    }

    public function setBonus25Minutes(int $bonus25Minutes): self
    {
        $this->bonus25Minutes = $bonus25Minutes;

        return $this;
    }

    public function getBase50Minutes(): int
    {
        return $this->base50Minutes;
    }

    public function setBase50Minutes(int $base50Minutes): self
    {
        $this->base50Minutes = $base50Minutes;

        return $this;
    }

    public function getBonus50Minutes(): int
    {
        return $this->bonus50Minutes;
    }

    public function setBonus50Minutes(int $bonus50Minutes): self
    {
        $this->bonus50Minutes = $bonus50Minutes;

        return $this;
    }

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

    public function getUpdatedAt(): DateTimeImmutable
    {
        return $this->updatedAt;
    }

    public function touch(): self
    {
        $this->updatedAt = new DateTimeImmutable();

        return $this;
    }
}
