<?php

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

if ( !class_exists( 'Reon' ) ) {
    return;
}

if ( !class_exists( 'Pricely_Admin_Product_Prices_Panel_Options' ) ) {

    class Pricely_Admin_Product_Prices_Panel_Options {

        public function __construct() {

            add_filter( 'pricely_admin_product-pricing_get-panel-option-fields', array( $this, 'get_fields' ), 10 );
        }

        public function get_fields( $in_fields ) {

            $pricing_types = Pricely_Admin_Product_Prices_Types::get_instance();

            $args = array(
                'module' => 'product-pricing',
                'format_text' => esc_html__( 'price adjustment', 'pricely-dynamic-pricing-cart-discounts' ),
            );


            $mode_types = $pricing_types->get_modes( $args );

            foreach ( array_keys( $mode_types ) as $mode_type ) {

                $in_fields = $pricing_types->get_mode_fields( $in_fields, $mode_type, $args );
            }

            return $in_fields;
        }

    }

    new Pricely_Admin_Product_Prices_Panel_Options();
}