import { object, string, minLength, optional, number, boolean as vBoolean, picklist } from "valibot";

export const CheckNumberSchema = object({
  phoneNumber: string([minLength(1)]),
});

export const ClassifySMSSchema = object({
  text: string([minLength(1)]),
});

export const ClassifyCallSchema = object({
  callerNumber: string([minLength(1)]),
  duration: optional(number()),
  timeOfDay: optional(number()),
});

export const CreateRuleSchema = object({
  ruleType: picklist(["phoneNumber", "areaCode", "prefix", "pattern", "reputation"]),
  pattern: string([minLength(1)]),
  action: picklist(["block", "flag", "allow", "challenge"]),
  priority: optional(number(), 0),
});

export const DeleteRuleSchema = object({
  ruleId: string([minLength(1)]),
});

export const FeedbackSchema = object({
  phoneNumber: string([minLength(1)]),
  isSpam: vBoolean(),
  feedbackType: picklist(["initial_detection", "user_confirmation", "user_rejection", "auto_learned"]),
});

export const StatsFilterSchema = object({
  period: optional(picklist(["day", "week", "month", "year"]), "month"),
});
