<?php
/**
 * AI Job class.
 *
 * @package AMVE\Admin\Class\Ai
 */

namespace Amve\Ai;

use JsonSerializable;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * AI Job class.
 */
final class Ai_Job implements JsonSerializable {
	/**
	 * AI Job ID.
	 *
	 * @var string
	 */
	public $ai_job_id;

	/**
	 * AI Job status.
	 *
	 * @var string
	 */
	public $ai_job_status;

	/**
	 * AI Job content.
	 *
	 * @var string
	 */
	public $ai_job_content;

	/**
	 * Constructor.
	 *
	 * @param string $ai_job_id Job ID.
	 * @param string $ai_job_status Generation status. Can be 'processing', 'success' or 'error'.
	 * @param string $ai_job_content AI content.
	 */
	public function __construct( $ai_job_id, $ai_job_status, $ai_job_content = '' ) {
		$this->ai_job_id      = trim( $ai_job_id );
		$this->ai_job_status  = trim( $ai_job_status );
		$this->ai_job_content = $ai_job_content;
	}

	/**
	 * Get job ID.
	 *
	 * @return string Job ID.
	 */
	public function get_id() {
		return $this->ai_job_id;
	}

	/**
	 * Get AI status.
	 * Can be 'processing', 'success' or 'error'.
	 *
	 * @return string AI Job status.
	 */
	public function get_status() {
		return $this->ai_job_status;
	}

	/**
	 * Get AI content.
	 *
	 * @return array AI Job content.
	 */
	public function get_content() {
		return $this->ai_job_content;
	}

	/**
	 * Implementation of jsonSerialize.
	 *
	 * @return array Data to serialize.
	 */
	public function jsonSerialize() {
		return array(
			'job_id'         => $this->ai_job_id,
			'ai_job_status'  => $this->ai_job_status,
			'ai_job_content' => $this->ai_job_content,
		);
	}
}
