<?php

namespace Bookaro\Controller\Ajax;

defined( 'ABSPATH' ) || exit;


use Bookaro\Controller\AbstractController;

class OwnerSettingsController extends AbstractController
{
    public function register_hooks(): void
    {
        add_action('wp_ajax_bookaro_get_owner_settings', [ $this, 'get_owner_settings' ]);
    }

    public function get_owner_settings(): void
    {
        check_ajax_referer('bookaro_nonce', 'security');

        if ( ! is_user_logged_in() ) {
            wp_send_json_error( __( 'You must be logged in to view settings.', 'mybookaro' ) );
        }
        if ( ! bookaro_user_has_customer_access() ) {
            wp_send_json_error( __( 'You do not have permission to view customer settings.', 'mybookaro' ) );
        }

        wp_send_json_success( [] );
    }

}
