<?php
/**
 * Database inventory batch.
 *
 * @package LocalGuardScanner
 */

namespace LocalGuardScanner\Detection\Database;

use LocalGuardScanner\Domain\Detection\ScannableObject;

/**
 * Contains normalized objects and a stable numeric cursor.
 */
final class DatabaseBatch {
	/** @var ScannableObject[] */
	private $items;
	/** @var int */
	private $cursor;
	/** @var bool */
	private $done;
	/** @var array<string,int> */
	private $omissions;

	/**
	 * @param ScannableObject[] $items  Objects.
	 * @param int               $cursor Next cursor.
	 * @param bool              $done      Completion.
	 * @param array<string,int> $omissions Coverage omissions.
	 */
	public function __construct( array $items, $cursor, $done, array $omissions = array() ) {
		$this->items     = $items;
		$this->cursor    = (int) $cursor;
		$this->done      = (bool) $done;
		$this->omissions = $omissions;
	}

	/** @return ScannableObject[] */
	public function items() {
		return $this->items;
	}

	/** @return int */
	public function cursor() {
		return $this->cursor;
	}

	/** @return bool */
	public function done() {
		return $this->done;
	}

	/** @return array<string,int> */
	public function omissions() {
		return $this->omissions;
	}
}
