"use client";

import React from 'react';

interface PaymentMethodProps {
  selectedMethod: string;
  onMethodChange: (method: string) => void;
}

const PaymentMethod = ({ selectedMethod, onMethodChange }: PaymentMethodProps) => {
  return (
    <div className="payment-method">
      <h3>Payment method <span className="text-red-500">*</span></h3>
      <div className="flex flex-wrap gap-4">
        <div className="customRadio">
          <input 
            id="formcheckoutPg1" 
            value="cod" 
            name="payment_method" 
            type="radio" 
            className="radio"
            checked={selectedMethod === 'cod'}
            onChange={() => onMethodChange('cod')}
          /> 
          <label htmlFor="formcheckoutPg1">Cash on delivery</label>
        </div>
        <div className="customRadio clearfix">
          <input 
            id="formcheckoutPg2" 
            value="online" 
            name="payment_method" 
            type="radio" 
            className="radio"
            checked={selectedMethod === 'online'}
            onChange={() => onMethodChange('online')}
          /> 
          <label htmlFor="formcheckoutPg2">Online PAY</label>
        </div>
      </div>
    </div>
  );
};

export default PaymentMethod;