<?php

namespace SugarCalendarBookings\Support\Database\Relations;

// phpcs:ignore WPForms.PHP.UseStatement.UnusedUseStatement
use SugarCalendarBookings\Support\Database\AbstractModel;

/**
 * Morph many (polymorphic one-to-many) relation class.
 *
 * @since 1.0.0
 */
class MorphManyRelation extends AbstractRelation {

	/**
	 * Morph type column name.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	protected $morph_type_column;

	/**
	 * Morph ID column name.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	protected $morph_id_column;

	/**
	 * Local key on the parent model.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	protected $local_key;

	/**
	 * Object type value.
	 *
	 * @since 1.0.0
	 *
	 * @var string
	 */
	protected $object_type;

	/**
	 * Constructor.
	 *
	 * @since 1.0.0
	 *
	 * @param AbstractModel               $parent            Parent model instance.
	 * @param class-string<AbstractModel> $related           Related model class.
	 * @param string                      $morph_type_column Morph type column name.
	 * @param string                      $morph_id_column   Morph ID column name.
	 * @param string                      $local_key         Local key.
	 * @param string                      $object_type       Object type value.
	 */
	public function __construct( $parent, $related, $morph_type_column, $morph_id_column, $local_key, $object_type ) { // phpcs:ignore Universal.NamingConventions.NoReservedKeywordParameterNames.parentFound

		parent::__construct( $parent, $related );

		$this->morph_type_column = $morph_type_column;
		$this->morph_id_column   = $morph_id_column;
		$this->local_key         = $local_key;
		$this->object_type       = $object_type;
	}

	/**
	 * Get the morph type column name.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_morph_type_column() {

		return $this->morph_type_column;
	}

	/**
	 * Get the morph ID column name.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_morph_id_column() {

		return $this->morph_id_column;
	}

	/**
	 * Get the local key.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_local_key() {

		return $this->local_key;
	}

	/**
	 * Get the object type value.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_object_type() {

		return $this->object_type;
	}

	/**
	 * Get the default value for the relation.
	 *
	 * @since 1.0.0
	 *
	 * @return mixed
	 */
	public function get_default_value() {

		return [];
	}
}
