import { DatePicker, Form, Input, InputNumber, Select } from "antd";
import React from "react";


/**
 * 免费赠币活动链接
 * @returns 
 */
const ConsumeActivityLinkDTO: React.FC<BOOKLINK.BookLinkChildProps> = ({ restField, name }) => {


    return <>
        <Form.Item
            {...restField}
            name={[name, 'consumeActivityLinkDTO', 'activityName']}
            label={<strong>活动名称</strong>}
            rules={[{ required: true, message: '请输入活动名称!' }]}
        >
            <Input placeholder="请输入活动名称" style={{ width: '100%' }} allowClear />
        </Form.Item>

        <Form.Item
            {...restField}
            name={[name, 'consumeActivityLinkDTO', 'activityTime']}
            label={<strong>活动时间</strong>}
            rules={[{ required: true, message: '请选择活动时间!' }]}
        >
            <DatePicker.RangePicker />
        </Form.Item>
        <Form.Item
            {...restField}
            name={[name, 'consumeActivityLinkDTO', 'giftAmount']}
            rules={[{ required: true, message: '请输入赠送书币!' }]}
            label={<strong>赠送书币</strong>}
        >
            <InputNumber suffix="个" min={1} max={5000} placeholder="请输入（1~5000）" style={{ width: '100%' }} />
        </Form.Item>
        <Form.Item
            {...restField}
            name={[name, 'consumeActivityLinkDTO', 'rechargeCount']}
            label={<strong>赠送总次数</strong>}
            rules={[{ required: true, message: '请选择赠送总次数!' }]}
        >
            <Select
                showSearch
                placeholder="请选择赠送总次数"
                filterOption={(input, option) =>
                    ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
                }
                allowClear
                options={[{ label: '1次', value: 1 }, { label: '2次', value: 2 }, { label: '3次', value: 3 }]}
            />
        </Form.Item>
        <Form.Item
            {...restField}
            name={[name, 'consumeActivityLinkDTO', 'activityFrequencies', 'activityFrequenciesEnum']}
            label={<strong>频率限制</strong>}
            rules={[{ required: true, message: '请选择频率限制!' }]}
        >
            <Select
                showSearch
                placeholder="请选择频率限制"
                filterOption={(input, option) =>
                    ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
                }
                allowClear
                options={[{ label: '每天一次', value: 2 }, { label: '每周一次', value: 3 }]}
            />
        </Form.Item>
    </>
}

export default React.memo(ConsumeActivityLinkDTO);