<?php
if (!defined('ABSPATH')) exit; // Exit if accessed directly
/**
 * Handles the registration of Custom Post Types and Taxonomies.
 *
 * @package    Event_Monster
 * @subpackage Event_Monster/includes
 */
class Event_Monster_Free_CPT
{

    /**
     * Constructor. Hooks the registration functions into WordPress.
     */
    public function __construct()
    {
        add_action('init', array($this, 'register_post_type'));
        add_action('init', array($this, 'register_taxonomy'));
    }

    /**
     * Registers the 'awl_event_monster' Custom Post Type.
     * This code is moved from your Event_Monster() method.
     */
    public function register_post_type()
    {
        $labels = array(
            'name' => __('Event Monster', 'event-monster-premium'),
            'singular_name' => __('Event', 'event-monster-premium'),
            'menu_name' => __('Event Monster', 'event-monster-premium'),
            'add_new_item' => __('Add New Event', 'event-monster-premium'),
            // ... add all other labels from your original file ...
        );
        $args = array(
            'label' => __('Event', 'event-monster-premium'),
            'labels' => $labels,
            'supports' => ['title', 'editor', 'thumbnail', 'excerpt', 'categories'],
            'public' => true,
            'show_ui' => true,
            'show_in_menu' => true,
            'menu_position' => 65,
            'menu_icon' => 'dashicons-calendar-alt', // Using a Dashicon is more modern
            'has_archive' => true,
            'rewrite' => array('slug' => 'events'), // A cleaner URL slug
            'show_in_rest'        => false, // For Gutenberg support
        );
        register_post_type('awl_event_monster', $args);
    }

    /**
     * Registers the 'awplife-event-categories' taxonomy.
     * This code is also moved from your Event_Monster() method.
     */
    public function register_taxonomy()
    {
        $labels = array(
            'name' => _x('Event Categories', 'taxonomy general name', 'event-monster-premium'),
            'singular_name' => _x('Event Category', 'taxonomy singular name', 'event-monster-premium'),
            'search_items' => __('Search Event Categories', 'event-monster-premium'),
            'all_items' => __('All Event Categories', 'event-monster-premium'),
            'parent_item' => __('Parent Event Category', 'event-monster-premium'),
            'parent_item_colon' => __('Parent Event Category:', 'event-monster-premium'),
            'edit_item' => __('Edit Event Category', 'event-monster-premium'),
            'update_item' => __('Update Event Category', 'event-monster-premium'),
            'add_new_item' => __('Add New Event Category', 'event-monster-premium'),
            'new_item_name' => __('New Event Category Name', 'event-monster-premium'),
            'menu_name' => __('Event Categories', 'event-monster-premium'),
        );
        $args = array(
            'hierarchical' => true,
            'labels' => $labels,
            'show_ui' => true,
            'show_admin_column' => true,
            'query_var' => true,
            'rewrite' => array('slug' => 'event-category'),
        );
        register_taxonomy('awplife-event-categories', array('awl_event_monster'), $args);
    }
}