import { FormItem } from "/@/components/BasicForm";
import { isLicense } from "/@/utils/validate";

export const companyItems: Array<FormItem> = [
  {
    field: "companyNo",
    type: "input",
    labelWidth: "120px",
    label: "业务企业编号",
    placeholder: "业务企业编号",
    isHidden: true
  },
  {
    field: "company_name",
    type: "input",
    labelWidth: "120px",
    label: "业务企业名称",
    placeholder: "业务企业名称",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入业务企业名称"
      }
    ]
  },
  {
    field: "company_address",
    type: "input",
    labelWidth: "120px",
    label: "企业地址",
    placeholder: "企业地址",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入企业地址"
      }
    ]
  },
  {
    field: "company_license",
    type: "input",
    label: "企业纳税号",
    labelWidth: "120px",
    placeholder: "企业纳税号",
    rules: [
      {
        validator(_, value) {
          return isLicense(value);
        },
        required: true,
        message: "纳税人识别号格式不正确"
      }
    ]
  },
  {
    field: "bank_name",
    type: "input",
    labelWidth: "120px",
    label: "开户行",
    placeholder: "请输入开户行",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入开户行"
      }
    ]
  },
  {
    field: "bankNo",
    type: "input",
    labelWidth: "120px",
    label: "开户行账户",
    placeholder: "开户行账户",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入开户行账户"
      }
    ]
  },
  {
    field: "mobile",
    type: "contact",
    labelWidth: "120px",
    label: "企业联系方式",
    placeholder: "企业联系方式"
  }
];

export const inputItems: Array<FormItem> = [
  {
    field: "input_ticket",
    type: "radio",
    labelWidth: "120px",
    label: "验票方式",
    placeholder: "验票方式",
    options: [
      {
        label: "金润验票",
        value: "1"
      },
      {
        label: "人工验票",
        value: "2"
      }
    ],
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请选择验票方式"
      }
    ]
  }
];

export const outItems: Array<FormItem> = [
  {
    field: "out_ticket",
    type: "radio",
    labelWidth: "120px",
    label: "金税开票",
    options: [
      {
        label: "支持",
        value: "1"
      },
      {
        label: "不支持",
        value: "2"
      }
    ],
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请选择金税开票"
      }
    ]
  },
  {
    field: "voider",
    type: "input",
    labelWidth: "120px",
    label: "发票作废人",
    placeholder: "发票作废人",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入发票作废人"
      }
    ]
  },
  {
    field: "payee",
    type: "input",
    labelWidth: "120px",
    label: "收款人",
    placeholder: "收款人",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入收款人"
      }
    ]
  },
  {
    field: "reviewer",
    type: "input",
    labelWidth: "120px",
    label: "复核人",
    placeholder: "复核人",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入复核人"
      }
    ]
  },
  {
    field: "drawer",
    type: "input",
    labelWidth: "120px",
    label: "开票人",
    placeholder: "开票人",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入开票人"
      }
    ]
  },
  {
    field: "ownerPlace",
    type: "input",
    labelWidth: "120px",
    label: "归属地",
    placeholder: "归属地",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入归属地"
      }
    ]
  },
  {
    field: "denomination",
    type: "number",
    labelWidth: "120px",
    label: "面额",
    placeholder: "面额",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入面额"
      }
    ]
  },
  {
    field: "invoiceType",
    type: "checkbox",
    labelWidth: "120px",
    label: "发票支持类型",
    placeholder: "发票支持类型",
    rules: [
      {
        required: true,
        trigger: "change",
        message: "请输入发票支持类型"
      }
    ],
    options: [
      {
        label: "增值税专用发票",
        value: "04"
      },
      {
        label: "增值税普通发票",
        value: "07"
      },
      {
        label: "增值税电子专用发票",
        value: "27"
      },
      {
        label: "增值税电子普通发票",
        value: "26"
      }
    ]
  }
];
