<?php

declare(strict_types=1);

namespace App\Module\Absence\Domain\Enum;

enum AbsenceType: string
{
    case PaidLeave     = 'cp';
    case MarriagePacs  = 'mariage_pacs';
    case Birth         = 'naissance';
    case ParentalLeave = 'conge_parental';
    case Bereavement   = 'deces';
    case SickLeave     = 'maladie';

    public function label(): string
    {
        return match ($this) {
            self::PaidLeave     => 'Congés payés',
            self::MarriagePacs  => 'Mariage / PACS',
            self::Birth         => 'Naissance',
            self::ParentalLeave => 'Congé parental',
            self::Bereavement   => 'Décès proche',
            self::SickLeave     => 'Arrêt maladie',
        };
    }

    /**
     * Whether taking this absence decrements a balance.
     *
     * Only paid leave (CP) draws down an acquired balance. Family-event leaves
     * (marriage/PACS, birth, bereavement) are per-event entitlements, parental
     * leave is a contract suspension, and sick leave is handled by social
     * security — none of them decrement a balance.
     */
    public function decrementsBalance(): bool
    {
        return self::PaidLeave === $this;
    }
}
