<?php

// Exit if accessed directly
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Bidda Public Class
 * 
 * This class defines all code necessary to run during the public-facing side of the site
 */
class Bidda_Public {
    
    /**
     * Register shortcodes
     */
    public function register_shortcodes() {
        // These will be defined when running within WordPress
        if (function_exists('add_shortcode')) {
            add_shortcode('bidda_login', array($this, 'shortcode_login'));
            add_shortcode('bidda_dashboard', array($this, 'shortcode_dashboard'));
            add_shortcode('bidda_my_fees', array($this, 'shortcode_my_fees'));
        }
    }
    
    /**
     * Enqueue styles
     */
    public function enqueue_styles() {
        //wp_enqueue_style('bidda-public', BIDDA_PLUGIN_URL . 'assets/css/public.css', array(), '1.0.0', 'all');
    }
    
    /**
     * Enqueue scripts
     */
    public function enqueue_scripts() {
        //wp_enqueue_script('bidda-public', BIDDA_PLUGIN_URL . 'assets/js/public.js', array('jquery'), '1.0.0', false);
    }
    
    /**
     * Shortcode for login page
     */
    public function shortcode_login($atts) {
        ob_start();
        ?>
        <div class="bidda-login-container">
            <h2>Bidda School Management Login</h2>
            <form method="post" action="">
                <div class="form-group">
                    <label for="username">Username:</label>
                    <input type="text" name="username" id="username" class="form-control" required>
                </div>
                <div class="form-group">
                    <label for="password">Password:</label>
                    <input type="password" name="password" id="password" class="form-control" required>
                </div>
                <div class="form-group">
                    <input type="submit" name="login" value="Login" class="btn btn-primary">
                </div>
            </form>
        </div>
        <?php
        return ob_get_clean();
    }
    
    /**
     * Shortcode for dashboard
     */
    public function shortcode_dashboard($atts) {
        ob_start();
        ?>
        <div class="bidda-dashboard-container">
            <h2>Bidda School Management Dashboard</h2>
            <p>Welcome to your school management dashboard.</p>
            <div class="bidda-dashboard-links">
                <a href="#" class="button">My Fees</a>
                <a href="#" class="button">My Profile</a>
                <a href="#" class="button">My Attendance</a>
            </div>
        </div>
        <?php
        return ob_get_clean();
    }
    
    /**
     * Shortcode for my fees
     */
    public function shortcode_my_fees($atts) {
        ob_start();
        ?>
        <div class="bidda-fees-container">
            <h2>My School Fees</h2>
            <p>This section will display your fee information.</p>
            <p>To view your fees, please login to your account.</p>
        </div>
        <?php
        return ob_get_clean();
    }
}