<?php
if (!defined('ABSPATH')) {
    exit;
}

class Manfiet_Expense_Tracker_Pages {
    public static function create_expense_page() {
        $existing_page = get_posts([
            'name'        => 'user-expenses',
            'post_type'   => 'page',
            'post_status' => 'publish',
            'numberposts' => 1,
        ]);

        if (empty($existing_page)) {
            wp_insert_post([
                'post_title'   => __('User Expenses', 'manfi-expense-tracker'),
                'post_name'    => 'user-expenses',
                'post_content' => '[manfiet_expense_tracker]',
                'post_status'  => 'publish',
                'post_type'    => 'page',
            ]);
        }
    }
}
