<?php

namespace KnitPayUPI\Gateways\UpiQR\Paytm;

use KnitPayUPI\Gateways\UpiQR\KnitPayUPIIntegration;

/**
 * Title: PhonePe for Business Integration
 * Copyright: 2020-2026 Knit Pay
 *
 * @author  Knit Pay
 * @version 1.0.0
 * @since   1.0.0
 */
class Integration extends KnitPayUPIIntegration {
	/**
	 * Construct UPI QR integration.
	 *
	 * @param array $args Arguments.
	 */
	public function __construct( $args = [] ) {
		$args = wp_parse_args(
			$args,
			[
				'id'           => 'paytm-business',
				'name'         => 'UPI/QR - Paytm for Business',
				'product_url'  => 'https://play.google.com/store/apps/details?id=com.paytm.business',
				'provider'     => 'paytm-business',
				'gateway_name' => 'Paytm for Business',
			]
		);

		parent::__construct( $args );
	}
	
	public function get_config( $post_id ) {
		$config = new Config();
		$config->copy_properties( parent::get_config( $post_id ) );
		
		$config->mid             = $this->get_meta( $post_id, 'upi_qr_paytm_mid' );
		$config->hide_mobile_qr  = false;
		$config->hide_pay_button = true;

		return $config;
	}

	public function get_setup_settings_fields( $fields ) {
		// MID.
		$fields[] = [
			'section'  => 'general',
			'meta_key' => '_pronamic_gateway_upi_qr_paytm_mid',
			'title'    => __( 'Paytm MID', 'knit-pay-lang' ),
			'type'     => 'text',
			'classes'  => [ 'regular-text', 'code' ],
			'required' => true,
		];
		
		$fields = parent::get_setup_settings_fields( $fields );
		
		unset( $fields['transaction_id_field'] );
		
		return $fields;
	}
}
