<?php

defined( 'ABSPATH' ) or exit;

final class PWLPAR_Admin_Meta_Boxes {

    function __construct() {
        add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 20 );
    }

    function add_meta_boxes() {
        // $theorder comes from WooCommerce since we are adding a meta box to the Order page.
        global $theorder;

        // Only show the loyalty points box for subscribed customers.
        if ( is_a( $theorder, 'WC_Order' ) && !empty( $theorder->get_user_id( 'edit' ) ) ) {
            include __DIR__ . '/meta-boxes/class-pwlpar-meta-box-points.php';
            add_meta_box( 'pwlpar-order-points', pwlpar_program_name(), 'PWLPAR_Meta_Box_Points::output', null, 'side', 'default' );
        }
    }
}
