import { z } from "zod";

const sellerBankAccountSchema = z.object({
  bank_id: z.string().trim().min(1, "Bank wajib dipilih"),
  account_number: z.string().trim().min(1, "Nomor rekening wajib diisi").max(100)
});

export const salesInputSchema = z.object({
  code: z.string().trim().max(20).optional().or(z.literal("")),
  name: z.string().trim().min(1, "Nama sales wajib diisi").max(150),
  identity_type: z.enum(["KTP", "SIM", "PASSPORT"]),
  identity_number: z.string().trim().min(1, "Nomor identitas wajib diisi").max(100),
  mobile_phone: z.string().trim().max(50).optional().or(z.literal("")),
  email: z.string().trim().email("Format email tidak valid").max(150).optional().or(z.literal("")),
  address: z.string().trim().max(2000).optional().or(z.literal("")),
  notes: z.string().trim().max(2000).optional().or(z.literal("")),
  join_date: z.string().trim().min(1, "Join date wajib diisi"),
  bank_accounts: z.array(sellerBankAccountSchema).min(1, "Minimal satu rekening bank wajib diisi")
});
