<?php
/**
 * post type: emails
 */

class ST_ProQyz_Post_Email {
    /**
	 * ProQyz_Post_Email version.
	 *
	 * @var string
	 */
    public $version = '1.0.0';

    protected static $_instance = null;

    /**
	 * Main Instance.
	 *
	 * Ensures only one instance is loaded or can be loaded.
	 *
	 * @since 1.0
	 * @static
	 * @return ST_ProQyz_Post_Email - Main instance.
	 */
    public static function instance() {
        if ( is_null( self::$_instance ) ) {
            self::$_instance = new self();
        }
        return self::$_instance;
    }

    public function __construct() {
        add_action( 'init', [ $this, 'proqyz_register_email_post_type' ], 0 );
    }

    // Register Custom Post Type
    public function proqyz_register_email_post_type() {
        $labels = array(
            'name'                  => _x( 'Emails', 'Post Type General Name', 'proqyz' ),
            'singular_name'         => _x( 'Email', 'Post Type Singular Name', 'proqyz' ),
            'menu_name'             => __( 'Emails', 'proqyz' ),
            'all_items'             => __( 'All Emails', 'proqyz' ),
            'add_new'               => __( 'Add New', 'proqyz' ),
            'add_new_item'          => __( 'Add New Email', 'proqyz' ),
            'edit_item'             => __( 'Edit Email', 'proqyz' ),
            'new_item'              => __( 'New Email', 'proqyz' ),
            'view_item'             => __( 'View Email', 'proqyz' ),
            'search_items'          => __( 'Search Emails', 'proqyz' ),
            'not_found'             => __( 'No emails found', 'proqyz' ),
            'not_found_in_trash'    => __( 'No emails found in Trash', 'proqyz' ),
            'parent_item_colon'     => __( 'Parent Email:', 'proqyz' ),
            'menu_icon'             => 'dashicons-email', // You can change the icon
        );

        $args = array(
            'labels'                => $labels,
            'public'                => true,
            'publicly_queryable'    => true,
            'show_ui'               => true,
            'show_in_menu'          => false,
            'query_var'             => false,
            'rewrite'               => array( 'slug' => 'proqyz-email' ),
            'capability_type'       => 'post',
            'has_archive'           => true,
            'hierarchical'          => false,
            'menu_position'         => null,
            'supports'              => array( 'title', 'editor' ),
        );

        register_post_type( 'proqyz-email', $args );
    }
}

return ST_ProQyz_Post_Email::instance();
