<?php

namespace Planaday\Entities\Course\DTO;

use Planaday\Entities\CostsData;

class CourseMaterial {
	protected string $code = '';
	protected string $name = '';
	protected string $description = '';
	protected ?CostsData $costsData = null;
	protected int $amount = 0;
	protected bool $invoicedPerCompany = false;
	protected bool $invoicedPerStudent = false;
	
	public function __construct(
		protected int $id
	) {}

	public function setCode( ?string $code ): self {
		$this->code = $code ?? $this->code;

		return $this;
	}

	public function setName( ?string $name ): self {
		$this->name = $name ?? $this->name;

		return $this;
	}

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

		return $this;
	}

	public function setCostsData( ?CostsData $costsData ): self {
		$this->costsData = $costsData;

		return $this;
	}

	public function setAmount( ?int $amount ): self {
		$this->amount = $amount ?? $this->amount;

		return $this;
	}

	public function setInvoicedPerCompany( ?bool $invoicedPerCompany ): self {
		$this->invoicedPerCompany = $invoicedPerCompany ?? $this->invoicedPerCompany;

		return $this;
	}

	public function setInvoicedPerStudent( ?bool $invoicedPerStudent ): self {
		$this->invoicedPerStudent = $invoicedPerStudent ?? $this->invoicedPerStudent;

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

	public function getCode(): string {
		return $this->code;
	}

	public function getName(): string {
		return $this->name;
	}

	public function getCostsData(): CostsData {
		if ( $this->costsData === null ) {
			$this->costsData = new CostsData();
		}
		
		return $this->costsData;
	}

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

	public function getAmount(): int {
		return $this->amount;
	}

	public function isInvoicedPerStudent(): bool {
		return $this->invoicedPerStudent;
	}

	public function isInvoicedPerCompany(): bool {
		return $this->invoicedPerCompany;
	}
}