const validators = {
  required: (label) => (v) => v.trim() ? null : `${label} is required`,
  url: (v) => {
    if (!v.trim()) return "URL is required";
    try {
      const url = new URL(v);
      if (!["http:", "https:"].includes(url.protocol)) {
        return "URL must use http:// or https://";
      }
      return null;
    } catch {
      return "Invalid URL format";
    }
  },
  positiveNumber: (v) => {
    if (!v.trim()) return null;
    const num = parseInt(v, 10);
    if (isNaN(num) || num <= 0) return "Must be a positive number";
    return null;
  },
  slashFormat: (v) => {
    if (!v.trim()) return "Model ID is required";
    if (!v.includes("/")) return "Must use format: provider/model-name";
    return null;
  }
};
export {
  validators
};
