<?php
/**
 * Article Schema Type
 *
 * @package SEOvaultSEO\Schema\Types
 */

namespace SEOvaultSEO\Schema\Types;

use SEOvaultSEO\Schema\SchemaBase;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

class Article extends SchemaBase {

	public function schema_data() {
		return array(
			'title'   => 'Article',
			'type'    => 'Article',
			'show_on' => array(
				'rules'        => array( 'post|post' ),
				'specific'     => array(),
				'specificText' => array(),
			),
			'fields'  => $this->parse_fields( $this->get() ),
		);
	}

	public function get() {
		return apply_filters(
			'seovaultseo_schema_type_article',
			array(
				array(
					'id'      => 'schema_name',
					'label'   => __( 'Schema Title', 'seovault-ai' ),
					'show'    => true,
					'default' => true,
					'type'    => 'Title',
					'std'     => 'Article',
				),
				array(
					'id'       => '@id',
					'type'     => 'Hidden',
					'std'      => '%current.url%#article',
					'required' => true,
					'default'  => true,
					'show'     => true,
				),
				array(
					'id'       => 'headline',
					'label'    => __( 'Headline', 'seovault-ai' ),
					'required' => true,
					'std'      => '%post.title%',
					'type'     => 'Text',
					'default'  => true,
					'show'     => true,
				),
				array(
					'id'      => 'description',
					'label'   => __( 'Description', 'seovault-ai' ),
					'default' => true,
					'show'    => true,
					'std'     => '%post.excerpt%',
					'type'    => 'Text',
				),
				array(
					'id'       => 'url',
					'label'    => __( 'URL', 'seovault-ai' ),
					'required' => true,
					'std'      => '%post.url%',
					'type'     => 'Text',
					'default'  => true,
					'show'     => true,
				),
				array(
					'id'      => 'datePublished',
					'label'   => __( 'Date Published', 'seovault-ai' ),
					'type'    => 'DateTime',
					'default' => true,
					'show'    => true,
					'std'     => '%post.published_date%',
				),
				array(
					'id'      => 'dateModified',
					'label'   => __( 'Date Modified', 'seovault-ai' ),
					'type'    => 'DateTime',
					'default' => true,
					'show'    => true,
					'std'     => '%post.modified_date%',
				),
				array(
					'id'      => 'author',
					'label'   => __( 'Author', 'seovault-ai' ),
					'std'     => '%schemas.person%',
					'type'    => 'Text',
					'default' => true,
					'show'    => true,
				),
				array(
					'id'      => 'publisher',
					'label'   => __( 'Publisher', 'seovault-ai' ),
					'std'     => '%schemas.organization%',
					'type'    => 'Text',
					'default' => true,
					'show'    => true,
				),
				array(
					'id'      => 'mainEntityOfPage',
					'label'   => __( 'Main Entity', 'seovault-ai' ),
					'std'     => '%post.url%',
					'type'    => 'Text',
					'default' => true,
					'show'    => true,
				),
				array(
					'id'      => 'isPartOf',
					'label'   => __( 'Part of', 'seovault-ai' ),
					'std'     => '%site.url%#website',
					'type'    => 'Text',
					'default' => true,
					'show'    => true,
				),
			)
		);
	}
}
