'use client';

import { Input } from '@/components/ui/input';
import { Land } from '@/app/(app)/land-information/archive/manage/page';

interface LandOwnershipInfoProps {
  formData: Partial<Land>;
  onChange: (data: Partial<Land>) => void;
}

export function LandOwnershipInfo({ formData, onChange }: LandOwnershipInfoProps) {
  const handleFieldChange = (field: keyof Land, value: any) => {
    onChange({ ...formData, [field]: value });
  };

  return (
    <div className="space-y-4">
      <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
        <div>
          <label className="block text-sm font-medium mb-2">权属人 *</label>
          <Input
            value={formData.owner || ''}
            onChange={(e) => handleFieldChange('owner', e.target.value)}
            placeholder="姓名"
            required
          />
        </div>

        <div>
          <label className="block text-sm font-medium mb-2">联系电话</label>
          <Input
            type="tel"
            value={formData.ownerPhone || ''}
            onChange={(e) => handleFieldChange('ownerPhone', e.target.value)}
            placeholder="手机号码"
          />
        </div>

        <div>
          <label className="block text-sm font-medium mb-2">确权证号</label>
          <Input
            value={formData.certificateNumber || ''}
            onChange={(e) => handleFieldChange('certificateNumber', e.target.value)}
            placeholder="土地确权证书编号"
          />
        </div>

        <div>
          <label className="block text-sm font-medium mb-2">承包期限（年）</label>
          <Input
            type="number"
            value={formData.contractPeriod || ''}
            onChange={(e) => handleFieldChange('contractPeriod', Number(e.target.value))}
            placeholder="如：30"
          />
        </div>

        <div>
          <label className="block text-sm font-medium mb-2">承包开始</label>
          <Input
            type="date"
            value={formData.contractStartDate || ''}
            onChange={(e) => handleFieldChange('contractStartDate', e.target.value)}
          />
        </div>

        <div>
          <label className="block text-sm font-medium mb-2">承包结束</label>
          <Input
            type="date"
            value={formData.contractEndDate || ''}
            onChange={(e) => handleFieldChange('contractEndDate', e.target.value)}
          />
        </div>
      </div>
    </div>
  );
}