<?php

/**
 * Meta Module
 *
 * Handles SEO meta tags (title, description, canonical) functionality.
 *
 * @package ProRank\SEO\Modules\Content
 * @since   1.0.0
 */

declare(strict_types=1);

namespace ProRank\SEO\Modules\Content;

use ProRank\SEO\Modules\BaseModule;

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


/**
 * Meta module class
 */


class Meta extends BaseModule {
    
    /**
     * Module slug
     *
     * @var string
     */
    protected string $slug = 'meta';
    
    /**
     * Initialize module
     *
     * @return void
     */
    public function init(): void {
        parent::init();
        
        // Register REST controller
        add_action('rest_api_init', [$this, 'register_rest_controller']);
    }
    
    /**
     * Initialize hooks
     *
     * @return void
     */
    public function init_hooks(): void {
        // This module doesn't need any hooks at this time
        // The REST controller is registered in init() method
    }
    
    /**
     * Register REST controller
     *
     * @return void
     */
    public function register_rest_controller(): void {
        if (class_exists('\ProRank\SEO\Core\RestApi\MetaController')) {
            $controller = new \ProRank\SEO\Core\RestApi\MetaController();
            $controller->register_routes();
        }
    }
    
    /**
     * Get module name
     *
     * @return string
     */
    public function get_name(): string {
        return __('Meta Tags', 'prorank-seo');
    }
    
    /**
     * Get module description
     *
     * @return string
     */
    public function get_description(): string {
        return __('Manage SEO titles, meta descriptions, and canonical URLs.', 'prorank-seo');
    }
    
    /**
     * Check if module is active
     *
     * @return bool
     */
    public function is_active(): bool {
        // Meta tags are always active in free tier
        return true;
    }
}