<?php
declare (strict_types=1);

namespace App\ApiResources\Dolibarr;

use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\ApiProperty;
use App\ApiResources\ApiResourcesInterface;
use Symfony\Component\Serializer\Annotation\Groups;

/**
 *  Lines (services) included in a society contract, as retrieved from dolibarr
 */
#[ApiResource(
    operations: [
        new Get()
    ]
)]
class DolibarrContractLine implements ApiResourcesInterface
{
    #[ApiProperty(identifier: true)]
    #[Groups('dolibarr_get')]
    private int $id;

    /**
     * Id of the contract's line
     */
    #[Groups('dolibarr_get')]
    private int $contractId;

    /**
     * Reference of the contracted service ( = product's reference)
     */
    #[Groups('dolibarr_get')]
    private string $serviceRef;

    /**
     * Label of the contracted service
     */
    #[Groups('dolibarr_get')]
    private string $serviceLabel;

    /**
     * Service active from date ...
     */
    #[Groups('dolibarr_get')]
    private ?\DateTimeInterface $dateStart = null;

    /**
     * Service active to date ...
     */
    #[Groups('dolibarr_get')]
    private ?\DateTimeInterface $dateEnd = null;

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

    public function setId(int $id): self
    {
        $this->id = $id;
        return $this;
    }

    public function getContractId(): int
    {
        return $this->contractId;
    }

    public function setContractId(int $contractId): self
    {
        $this->contractId = $contractId;
        return $this;
    }

    public function getServiceRef(): string
    {
        return $this->serviceRef;
    }

    public function setServiceRef(string $serviceRef): self
    {
        $this->serviceRef = $serviceRef;
        return $this;
    }

    public function getServiceLabel(): string
    {
        return $this->serviceLabel;
    }

    public function setServiceLabel(string $serviceLabel): self
    {
        $this->serviceLabel = $serviceLabel;
        return $this;
    }

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

    public function setDateStart(?\DateTime $dateStart): self
    {
        $this->dateStart = $dateStart;
        return $this;
    }

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

    public function setDateEnd(?\DateTime $dateEnd): self
    {
        $this->dateEnd = $dateEnd;
        return $this;
    }
}
