<?php
/**
 * Invoices settings section.
 *
 * @package PDFDraft_WooCommerce
 */

namespace PDFDraft\Woocommerce\Admin\Settings\Sections;

use PDFDraft\Woocommerce\Admin\Settings\SectionInterface;

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

/**
 * Provides the sidebar item and localized select options for the Invoices section.
 */
class InvoicesSection implements SectionInterface {

	/**
	 * {@inheritdoc}
	 */
	public function getKey(): string {
		return 'invoices';
	}

	/**
	 * {@inheritdoc}
	 */
	public function getLabel(): string {
		return __( 'Invoices', 'pdfdraft-pdf-invoices-for-woocommerce' );
	}

	/**
	 * {@inheritdoc}
	 */
	public function getLocalizedData(): array {
		return array(
			// Open the editor directly on the "New Template" route in Woo context,
			// and preselect WooCommerce templates in the left sidebar.
			'editor_url_for_woo'          => admin_url( 'admin.php?page=pdfdraft' ) . '#/woo/new',
			'generation_mode_options'     => array(
				array(
					'value'       => 'automatic',
					'label'       => __( 'Automatic', 'pdfdraft-pdf-invoices-for-woocommerce' ),
					/* translators: WooCommerce PDF generation mode description. */
					'description' => __(
						'PDFs are generated as soon as an order status is changed to completed.',
						'pdfdraft-pdf-invoices-for-woocommerce'
					),
				),
				array(
					'value'       => 'manual',
					'label'       => __( 'Manual', 'pdfdraft-pdf-invoices-for-woocommerce' ),
					/* translators: WooCommerce PDF generation mode description. */
					'description' => __(
						'PDFs are only generated when you click "Generate PDF" in the list table.',
						'pdfdraft-pdf-invoices-for-woocommerce'
					),
				),
			),
			'invoice_number_mode_options' => array(
				array(
					'value'       => 'order_id',
					'label'       => __( 'Order ID', 'pdfdraft-pdf-invoices-for-woocommerce' ),
					'description' => __(
						'Use the WooCommerce order ID as the invoice number.',
						'pdfdraft-pdf-invoices-for-woocommerce'
					),
				),
				array(
					'value'       => 'sequential',
					'label'       => __( 'Sequential', 'pdfdraft-pdf-invoices-for-woocommerce' ),
					'description' => __(
						'Generate invoice numbers sequentially from the configured start value.',
						'pdfdraft-pdf-invoices-for-woocommerce'
					),
				),
			),
		);
	}
}
