import { Form, Input, InputNumber, Select } from "antd";
import React from "react";
import { PAGETYPE } from "../../const";


/**
 * 页面链接
 * @returns 
 */
const PagePromoLinkCreateDTO: React.FC<BOOKLINK.BookLinkChildProps> = ({ restField, name }) => {


    return <>
        <Form.Item
            {...restField}
            name={[name, 'pagePromoLinkCreateDTO', 'pageType']}
            label={<strong>页面类型</strong>}
            rules={[{ required: true, message: '请选择页面类型!' }]}
        >
            <Select
                showSearch
                placeholder="页面类型"
                filterOption={(input, option) =>
                    ((option?.label ?? '') as string).toLowerCase().includes(input.toLowerCase())
                }
                allowClear
                options={Object.keys(PAGETYPE).map(key => ({ label: PAGETYPE[key], value: key }))}
            />
        </Form.Item>
        <Form.Item
            {...restField}
            name={[name, 'pagePromoLinkCreateDTO', 'cost']}
            label={<strong>推广成本</strong>}
        >
            <InputNumber placeholder="请输入推广成本" style={{ width: '100%' }} />
        </Form.Item>
    </>
}

export default React.memo(PagePromoLinkCreateDTO);