import React from 'react';
import { Form, Input } from 'antd';
import type { RuleObject } from 'rc-field-form/lib/interface';
type RuleConfig = RuleObject

interface TextareaInputProps {
    name: string;
    label: string;
    rules?: RuleConfig[] | undefined;
    [key: string]: unknown;
}

const TextareaInput: React.FC<TextareaInputProps> = ({ name, label, rules, ...rest }) => {
  // Add the custom rule for maximum length

  // Add the custom rule to the rules array
  const updatedRules = [
    ...(rules ?? []), // Use the existing rules if provided
  ];

  return (
    <Form.Item label={label} name={name} rules={updatedRules}>
      <Input.TextArea {...rest} />
    </Form.Item>
  );
};

export default TextareaInput;
