<?php
/**
 * Invoice Service Provider
 *
 * @package Easy_Invoice
 * @subpackage Providers
 */

namespace EasyInvoice\Providers;

use EasyInvoice\Interfaces\InvoiceRepositoryInterface;
use EasyInvoice\Repositories\InvoiceRepository;

/**
 * InvoiceServiceProvider Class
 * 
 * Handles the registration of invoice-related services.
 */
class InvoiceServiceProvider {
    /**
     * The repository instance
     *
     * @var InvoiceRepositoryInterface
     */
    protected static $repository = null;
    
    /**
     * Register invoice services
     */
    public function register() {
        // Register service providers, load dependencies, etc.
        $this->registerRepositories();
        $this->registerHooks();
    }
    
    /**
     * Register repositories
     */
    protected function registerRepositories() {
        // This method would be more useful if you're using a dependency injection container
        // For now, it's just a placeholder to maintain structure for future expansion
    }
    
    /**
     * Register hooks
     */
    protected function registerHooks() {
        // Register any WordPress hooks related to invoices
        // Removed duplicate textdomain loading - it's handled in the main plugin file
    }
    
    /**
     * Load text domain
     */
    public function loadTextDomain() {
        // Removed - textdomain is loaded in the main plugin file
    }
    
    /**
     * Register invoice repository
     */
    protected function registerInvoiceRepository() {
        // Create and store the repository instance
        self::$repository = new InvoiceRepository();
    }
    
    /**
     * Get the invoice repository
     *
     * @return InvoiceRepositoryInterface The invoice repository
     */
    public static function getInvoiceRepository() {
        // Create the repository if it doesn't exist
        if (self::$repository === null) {
            self::$repository = new InvoiceRepository();
        }
        
        return self::$repository;
    }
} 