import { isqzf, isqz, iszf, isz, isMobile } from "/@/utils/validate";

const basic = {
  required: true,
  message: "联系方式格式不正确"
};

export const CONTACT_OPTIONS = [
  {
    value: "0",
    label: "区-固-分",
    rule: {
      ...basic,
      validator(_, value) {
        return isqzf(value);
      }
    }
  },
  {
    value: "1",
    label: "区-固",
    rule: {
      ...basic,
      validator(_, value) {
        return isqz(value);
      }
    }
  },
  {
    value: "2",
    label: "固-分",
    rule: {
      ...basic,
      validator(_, value) {
        return iszf(value || "");
      }
    }
  },
  {
    value: "3",
    label: "固",
    rule: {
      ...basic,
      validator(_, value) {
        return isz(value || "");
      }
    }
  },
  {
    value: "4",
    label: "手机号",
    rule: {
      ...basic,
      validator(_, value) {
        return isMobile(value || "");
      }
    }
  }
];
