<?php

/**
 * Views class for Shortcode generator options.
 *
 * @link       https://themeatelier.net
 * @since      1.0.0
 *
 * @package domain-for-sale
 * @subpackage domain-for-sale/src/Admin/Views/DomainForSaleMetaboxMainOptions
 * @author     ThemeAtelier<themeatelierbd@gmail.com>
 */

namespace ThemeAtelier\DomainForSale\Admin\Views\Metabox;

use ThemeAtelier\DomainForSale\Admin\Framework\Classes\DOMAIN_FOR_SALE;

class DomainForSaleMainOptions
{
    /**
     * Create Option fields for the setting options.
     *
     * @param string $prefix Option setting key prefix.
     * @return void
     */
    public static function options($prefix)
    {
        // Domain Options
        DOMAIN_FOR_SALE::createSection(
            $prefix,
            array(
                'title'  => esc_html__('Domain Options', 'domain-for-sale'),
                'icon'   => 'icofont-ui-settings',
                'fields' => array(
                    array(
                        'id'         => 'domain_name',
                        'type'       => 'text',
                        'title'      => esc_html__('Domain Name', 'domain-for-sale'),
                        'default'    => get_site_url(),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('The domain name to display on your sale page. Defaults to your site URL.', 'domain-for-sale') . '</div><a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/all-domains/#domain-options') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),

                    array(
                        'id'    => 'domain_logo',
                        'type'  => 'media',
                        'title' => esc_html__('Domain Logo', 'domain-for-sale'),
                        'title_help' =>
                        '<div class="domain-for-sale-info-label">' .
                            esc_html__('Upload or select an image to use as the domain logo.', 'domain-for-sale') .
                            '</div>',
                        'library' => 'image',
                        'preview' => true,
                    ),

                    array(
                        'id'      => 'form_options',
                        'type'    => 'button_set',
                        'inline'  => true,
                        'class'   => 'dfs_pro_only',
                        'title'   => esc_html__('Form Type(s)', 'domain-for-sale'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Choose what type of contact form visitors will see on this domain’s page. You can collect offers, enable direct sales via Escrow.com, or show both options together.', 'domain-for-sale') . '</div><a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/all-domains/#domain-options') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'desc'    => esc_html__('If you select ', 'domain-for-sale') . '<strong>' . esc_html__('"Sale with Escrow.com"', 'domain-for-sale') . '</strong> ' . esc_html__('or', 'domain-for-sale') . ' <strong>' . esc_html__('Both', 'domain-for-sale') . '</strong>, ' . esc_html__('please ensure that your Escrow.com payment integration is properly configured under', 'domain-for-sale') . ' <a href="' . esc_url(get_admin_url() . 'admin.php?page=domain-for-sale-settings#tab=payments') . '" target="_blank"><em>' . esc_html__('Domain for Sale → Settings → Payments', 'domain-for-sale') . '</em></a>.',
                        'options' => [
                            'get_proposal'  => array(
                                'text'  => esc_html__('Get Proposal', 'domain-for-sale'),
                            ),
                            'sale'          => array(
                                'text'  => esc_html__('Sale with Escrow.com', 'domain-for-sale'),
                                'pro_only'  => true,
                            ),
                            'both'          => array(
                                'text'  => esc_html__('Both (Inside Tab)', 'domain-for-sale'),
                                'pro_only'  => true,
                            ),
                        ],
                        'default' => 'get_proposal',
                    ),

                    array(
                        'id'      => 'price_options',
                        'type'    => 'radio',
                        'inline'  => true,
                        'class'    => 'color_scheme_type',
                        'title'   => esc_html__('Proposal Type(s)', 'domain-for-sale'),
                        'options' => array(
                            'fixed_price'    => esc_html__('Fixed Price', 'domain-for-sale'),
                            'receive_offers' => esc_html__('Receive Offers', 'domain-for-sale'),
                        ),
                        'default'    => 'fixed_price',
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Choose whether visitors can place offers or if the domain is sold at a fixed price.', 'domain-for-sale') . '</div><a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/all-domains/#domain-options') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                        'dependency' => array('form_options', 'any', 'get_proposal,both'),
                    ),

                    array(
                        'id'         => 'sell_price',
                        'type'       => 'number',
                        'title'      => esc_html__('Sale Price', 'domain-for-sale'),
                        'min'        => 1,
                        'dependency' => array('price_options', '==', 'fixed_price'),
                        'title_help' => '<div class="domain-for-sale-info-label">' . esc_html__('Set the exact selling price when using the "Fixed Price" option.', 'domain-for-sale') . '</div><a class="tooltip_btn_primary" target="_blank" href="' . esc_url(DOMAIN_FOR_SALE_DEMO_URL . 'docs/all-domains/#domain-options') . '">' . esc_html__('Open Docs', 'domain-for-sale') . '</a>',
                    ),
                ),
            )
        );
    }
}
