"use client";

import { Label } from "@/components/atoms";
import {
  JapanAddressForm,
  type JapanAddressFormData,
} from "@/features/address/components/JapanAddressForm";
import type { AccountFormErrors } from "./types";

interface AddressFieldsProps {
  onAddressChange: (data: JapanAddressFormData, isComplete: boolean) => void;
  errors: AccountFormErrors;
  loading: boolean;
}

/**
 * AddressFields - Standalone address form section.
 *
 * Used when an SF-unmapped user has incomplete prefilled address data
 * and needs to provide a full address before account creation.
 */
export function AddressFields({ onAddressChange, errors, loading }: AddressFieldsProps) {
  return (
    <div className="space-y-2">
      <Label>
        Address <span className="text-danger">*</span>
      </Label>
      <p className="text-sm text-muted-foreground">
        Your address information is incomplete. Please provide your full address.
      </p>
      <JapanAddressForm onChange={onAddressChange} disabled={loading} />
      {errors.address && <p className="text-sm text-danger">{errors.address}</p>}
    </div>
  );
}
