<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Registers the legacy "ai_section" post type.
 *
 * It is the only type that belongs to Aura by definition: with no 'editor' support and no REST,
 * Gutenberg never opens it (see {@see AIPB_Ownership::owner}). On every other type the choice is
 * made content by content.
 */
class AIPB_CPT {

	const POST_TYPE = 'ai_section';

	public static function init() {
		add_action( 'init', array( __CLASS__, 'register' ) );
	}

	public static function register() {
		register_post_type( self::POST_TYPE, array(
			'labels' => array(
				'name'          => __( 'AI sections', 'aipb' ),
				'singular_name' => __( 'AI section', 'aipb' ),
				'add_new_item'  => __( 'New AI section', 'aipb' ),
				'edit_item'     => __( 'Edit AI section', 'aipb' ),
				'menu_name'     => __( 'Aura', 'aipb' ),
			),
			'public'       => true,
			'has_archive'  => false,
			'show_in_rest' => false, // No Gutenberg: we use our own REST namespace.
			'menu_icon'    => 'dashicons-layout',
			'supports'     => array( 'title' ), // No 'editor' => no block area.
			// The slug STAYS ITALIAN: it is already in the permalinks of every site that has one
			// of these. Translating it would break those URLs to tidy up a string nobody reads.
			'rewrite' => array( 'slug' => 'sezione' ),
		) );
	}
}
