<?php
/**
 * Course Schema Type — guided field definitions.
 *
 * Server-authoritative form metadata. Emission remains gated by readiness.
 *
 * @package SEOvaultSEO\Schema\Types
 */

namespace SEOvaultSEO\Schema\Types;

use SEOvaultSEO\Schema\SchemaBase;

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

class Course extends SchemaBase {

	public function schema_data() {
		return array(
			'title'   => 'Course',
			'type'    => 'Course',
			'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_course',
			array(
				array(
					'id'      => 'schema_name',
					'label'   => __( 'Schema Title', 'seovault-ai' ),
					'show'    => true,
					'default' => true,
					'type'    => 'Title',
					'std'     => 'Course',
				),
				array(
					'id'       => '@id',
					'type'     => 'Hidden',
					'std'      => '%current.url%#course',
					'required' => true,
					'default'  => true,
					'show'     => true,
				),
				array(
					'id'       => 'name',
					'label'    => __( 'Course Name', 'seovault-ai' ),
					'desc'     => __( 'The course title as shown to learners on this page.', 'seovault-ai' ),
					'required' => true,
					'std'      => '',
					'type'     => 'Text',
					'default'  => true,
					'show'     => true,
				),
				array(
					'id'       => 'description',
					'label'    => __( 'Description', 'seovault-ai' ),
					'desc'     => __( 'What the course covers. Required for schema readiness.', 'seovault-ai' ),
					'required' => true,
					'default'  => true,
					'show'     => true,
					'std'      => '',
					'type'     => 'Textarea',
				),
				array(
					'id'       => 'provider',
					'label'    => __( 'Provider', 'seovault-ai' ),
					'desc'     => __( 'The organization or person offering the course. A provider name is required.', 'seovault-ai' ),
					'type'     => 'Group',
					'required' => true,
					'default'  => true,
					'show'     => true,
					'fields'   => array(
						array(
							'id'      => '@type',
							'type'    => 'Hidden',
							'std'     => 'Organization',
							'default' => true,
							'show'    => true,
						),
						array(
							'id'       => 'name',
							'label'    => __( 'Provider Name', 'seovault-ai' ),
							'desc'     => __( 'Name of the school, company, or instructor.', 'seovault-ai' ),
							'required' => true,
							'std'      => '',
							'type'     => 'Text',
							'default'  => true,
							'show'     => true,
						),
						array(
							'id'      => 'sameAs',
							'label'   => __( 'Provider URL', 'seovault-ai' ),
							'desc'    => __( 'Optional official website for the provider.', 'seovault-ai' ),
							'std'     => '',
							'type'    => 'URL',
							'default' => true,
							'show'    => true,
						),
					),
				),
			)
		);
	}
}
