<?php

namespace Planaday\Entities\Course\DTO;

class CourseUsersData {
	protected int $min = 0;
	protected int $max = 0;
	protected int $scheduled = 0;
	protected int $available = 0;
	protected int $options = 0;

	public function setMin( ?int $min ): self {
		$this->min = $min ?? $this->min;

		return $this;
	}

	public function setMax( ?int $max ): self {
		$this->max = $max ?? $this->max;

		return $this;
	}

	public function setScheduled( ?int $scheduled ): self {
		$this->scheduled = $scheduled ?? $this->scheduled;

		return $this;
	}

	public function setAvailable( ?int $available ): self {
		$this->available = $available ?? $this->available;

		return $this;
	}

	public function setOptions( ?int $options ): self {
		$this->options = $options ?? $this->options;

		return $this;
	}
	
	public function getMin(): int {
		return $this->min;
	}

	public function getMax(): int {
		return $this->max;
	}

	public function getScheduled(): int {
		return $this->scheduled;
	}

	public function getAvailable(): int {
		return $this->available;
	}

	public function getOptions(): int {
		return $this->options;
	}

	public function getAvailableSpots(bool $countOptions = true): int{
		if ($countOptions){
			return max($this->available - $this->options, 0);
		}

		return $this->available;
	}
}