<?php

namespace Yuvayana\Acadlix\Common\CPT;

defined('ABSPATH') || exit();

final class Announcement extends CPT_Abstract
{
  protected static $_instance = null;

  protected $_post_type = ACADLIX_ANNOUNCEMENT_CPT;

  public function __construct()
  {
    parent::__construct();
  }

  public function args_register_post_type(): array
  {
    $labels = array(
      'name' => _x('Announcements', 'Post Type General Name', 'acadlix'),
      'singular_name' => _x('Announcement', 'Post Type Singular Name', 'acadlix'),
      'menu_name' => __('Announcements', 'acadlix'),
      'parent_item_colon' => __('Parent Item:', 'acadlix'),
      'all_items' => __('All Announcements', 'acadlix'),
      'view_item' => __('View Announcement', 'acadlix'),
      'add_new_item' => __('Add a New Announcement', 'acadlix'),
      'add_new' => __('Add New', 'acadlix'),
      'edit_item' => __('Edit Announcement', 'acadlix'),
      'update_item' => __('Update Announcement', 'acadlix'),
      'search_items' => __('Search Announcements', 'acadlix'),
      'not_found' => __('Not Found', 'acadlix'),
      'not_found_in_trash' => __('Not found in Trash', 'acadlix'),
    );
    $args = array(
      'labels' => $labels,
      'description' => __('Announcement custom post type for acadlix', 'acadlix'),
      'public' => false,
      'query_var' => false,
      'has_archive' => false,
      'capability_type' => $this->_post_type,
      'map_meta_cap' => false,
      'show_in_menu' => false,
      'show_in_rest' => true,
      'rewrite' => false,
      'supports' => array('title', 'editor'),
    );
    return $args;
  }

  public static function instance()
  {
    if (!self::$_instance) {
      self::$_instance = new self();
    }

    return self::$_instance;
  }
}