<?php
declare(strict_types=1);

namespace App\Entity\Traits;

use App\Attribute\DateTimeConstraintAware;
use Doctrine\ORM\Mapping as ORM;

trait ActivityPeriodTrait
{
    #[ORM\Column(type: 'date', nullable: true)]
    private ?\DateTimeInterface $startDate = null;

    #[ORM\Column(type: 'date', nullable: true)]
    private ?\DateTimeInterface $endDate = null;

    public function getStartDate(): ?\DateTimeInterface {
        return $this->startDate;
    }

    public function setStartDate(?\DateTime $startDate = null): self {
        if($startDate == null) $startDate = new \DateTime();
        $this->startDate = $startDate;
        return $this;
    }

    public function getEndDate(): ?\DateTimeInterface {
        return $this->endDate;
    }

    public function setEndDate(?\DateTime $endDate = null) :self {
        $this->endDate = $endDate;
        return $this;
    }
}