<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

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

    #[ORM\ManyToOne(targetEntity: Advert::class, inversedBy: 'lines')]
    #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')]
    private Advert $advert;

    #[ORM\Column]
    private int $pos = 0;

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

    #[ORM\Column(type: 'text', nullable: true)]
    private ?string $description = null;

    #[ORM\Column(type: 'decimal', precision: 10, scale: 2, options: ['default' => '0.00'])]
    private string $priceHt = '0.00';

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

    #[ORM\Column(nullable: true)]
    private ?int $serviceId = null;

    public function __construct(Advert $advert, string $title, string $priceHt = '0.00', int $pos = 0)
    {
        $this->advert = $advert;
        $this->title = $title;
        $this->priceHt = $priceHt;
        $this->pos = $pos;
    }

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

    public function getAdvert(): Advert
    {
        return $this->advert;
    }

    public function getPos(): int
    {
        return $this->pos;
    }

    public function setPos(int $pos): static
    {
        $this->pos = $pos;

        return $this;
    }

    public function getTitle(): string
    {
        return $this->title;
    }

    public function setTitle(string $title): static
    {
        $this->title = $title;

        return $this;
    }

    public function getDescription(): ?string
    {
        return $this->description;
    }

    public function setDescription(?string $description): static
    {
        $this->description = $description;

        return $this;
    }

    public function getPriceHt(): string
    {
        return $this->priceHt;
    }

    public function setPriceHt(string $priceHt): static
    {
        $this->priceHt = $priceHt;

        return $this;
    }

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

    public function setType(?string $type): static
    {
        $this->type = $type;

        return $this;
    }

    public function getServiceId(): ?int
    {
        return $this->serviceId;
    }

    public function setServiceId(?int $serviceId): static
    {
        $this->serviceId = $serviceId;

        return $this;
    }
}
