<?php

use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;

class WC_Gateway_Wooplatnica_Blocks extends AbstractPaymentMethodType {
  protected $name = 'uplatnica';

  public function initialize() {
    $this->settings = get_option('woocommerce_uplatnica_settings', []);
  }

  public function is_active() {
    return $this->settings['enabled'] === 'yes';
  }

  public function get_payment_method_script_handles() {
    wp_register_script(
      'wc-wooplatnica-blocks',
      plugins_url('assets/js/wooplatnica-blocks.js', WOOPLATNICA_FILE),
      ['wc-blocks-registry', 'wp-element', 'wp-hooks', 'wc-blocks'],
      null,
      true
    );
    return ['wc-wooplatnica-blocks'];
  }

  public function get_payment_method_data() {
    return [
      'title'       => $this->settings['title'],
      'description' => $this->settings['description'],
      'supports'    => ['products'],
    ];
  }
}
