import { Form, InputNumber } from "antd";
import React from "react";
import SelectBook from "../../selectBook";

interface Props extends BOOKLINK.BookLinkChildProps {
    platform: string,
}
/**
 * 作品链接
 * @returns 
 */
const BookPromoLinkCreateDTO: React.FC<Props> = ({ restField, name, platform }) => {

    /**********************************/
    /**********************************/

    return <>
        <Form.Item
            {...restField}
            name={[name, 'bookPromoLinkCreateDTO', 'bookId']}
            rules={[{ required: true, message: '请输入作品(书籍)ID!' }]}
            label={<strong>作品(书籍)ID</strong>}
        >
            <SelectBook
                platformKey={platform}
                isSearchChapter={false}
            />
        </Form.Item>

        <Form.Item
            {...restField}
            name={[name, 'bookPromoLinkCreateDTO', 'chapterId']}
            label={<strong>章节</strong>}
            rules={[{ required: true, message: '请输入章节（1~19）!' }]}
        >
            <InputNumber style={{ width: '100%' }} min={1} max={19} placeholder="请输入章节（1~19）" />
        </Form.Item>
    </>
}

export default React.memo(BookPromoLinkCreateDTO);