<?php

namespace Limb_Chatbot\Includes\Data_Objects;

/**
 * Rating data object.
 *
 * @since 2.0.0
 */
class Rating extends WPDB_Data_Object {

	/**
	 * Database table name.
	 */
	const TABLE_NAME = 'lbaic_ratings';

	/**
	 * Attributes allowed for mass assignment.
	 *
	 * @var array
	 */
	const FILLABLE = [
		'id',
		'from_type',
		'from_id',
		'target_type',
		'target_id',
		'rate',
		'notes',
		'metadata',
		'chatbot_user_id',
		'created_at',
		'source_id',
	];

	/**
	 * Primary ID.
	 *
	 * @var int|null
	 */
	public ?int $id = null;

	/**
	 * Origin record type.
	 *
	 * @var string|null
	 */
	public ?string $from_type = null;

	/**
	 * Origin record ID.
	 *
	 * @var int|null
	 */
	public ?int $from_id = null;

	/**
	 * Target record type.
	 *
	 * @var string|null
	 */
	public ?string $target_type = null;

	/**
	 * Target record ID.
	 *
	 * @var int|null
	 */
	public ?int $target_id = null;

	/**
	 * Rating value.
	 *
	 * @var int
	 */
	public int $rate;

	/**
	 * Optional free-text notes.
	 *
	 * @var string|null
	 */
	public ?string $notes = null;

	/**
	 * Optional metadata payload.
	 *
	 * @var array|string|null
	 */
	public $metadata = null;

	/**
	 * Related chatbot user ID.
	 *
	 * @var int|null
	 */
	public ?int $chatbot_user_id = null;

	/**
	 * Record creation timestamp.
	 *
	 * @var string
	 */
	public string $created_at;

	/**
	 * External/internal source reference.
	 *
	 * @var string|null
	 */
	public ?string $source_id = null;
}
