<?php

declare(strict_types=1);

namespace KimaAI\Admin\Integrations;

use KimaAI\Admin\Settings;

defined('ABSPATH') || exit;

class WooCommerceIntegration implements IntegrationInterface {

  /**
   * WooCommerce integration constructor.
   *
   * @param Settings $settings The settings service.
   */
  public function __construct(protected Settings $settings) {
  }

  /**
   * Gets the integration key.
   */
  public function getKey(): string {
    return 'woocommerce';
  }

  /**
   * Gets the integration label.
   */
  public function getLabel(): string {
    return __('WooCommerce', 'kimaai');
  }

  /**
   * Checks whether WooCommerce is active.
   */
  public function isActive(): bool {
    return class_exists('WooCommerce') && function_exists('WC');
  }

  /**
   * Checks whether WooCommerce integration is enabled.
   */
  public function isEnable(): bool {
    return (bool) $this->settings->getOption('isEnable', 'integrations', 'woocommerce');
  }
}
