<?php
/**
 * Post Types & Database Models
 *
 * @package Invizo\SubscriptionsLite\Core
 */

namespace Invizo\SubscriptionsLite\Core;

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

class CPT {

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

    public static function register_post_types() {
        
        // 1. Subscription Plans
        $plan_labels = array(
            'name'                  => _x( 'Plans', 'Post Type General Name', 'invizo-subscriptions-lite' ),
            'singular_name'         => _x( 'Plan', 'Post Type Singular Name', 'invizo-subscriptions-lite' ),
        );

        $plan_args = array(
            'label'                 => __( 'Plan', 'invizo-subscriptions-lite' ),
            'labels'                => $plan_labels,
            'supports'              => array( 'title' ),
            'public'                => false, // Handled completely internally via API
            'show_ui'               => false, // Hidden from WP menu (Managed via React UI)
            'show_in_rest'          => false,
            'capability_type'       => 'post',
        );
        register_post_type( 'invizo_plan', $plan_args );

        // 2. Subscriptions / Orders
        $sub_labels = array(
            'name'                  => _x( 'Subscriptions', 'Post Type General Name', 'invizo-subscriptions-lite' ),
            'singular_name'         => _x( 'Subscription', 'Post Type Singular Name', 'invizo-subscriptions-lite' ),
        );

        $sub_args = array(
            'label'                 => __( 'Subscription', 'invizo-subscriptions-lite' ),
            'labels'                => $sub_labels,
            'supports'              => array( 'title' ),
            'public'                => false,
            'show_ui'               => false, // Hidden from WP menu (Managed via React UI)
            'show_in_rest'          => false,
            'capability_type'       => 'post',
        );
        register_post_type( 'invizo_sub', $sub_args );
    }
}
