import { z } from "zod";
import { staffsSchema } from "./staff.schema";

export const complaintsSchema = z.object({
  id: z.number(),
  clientId: z.number(),
  tenantId: z.number(),
  propId: z.number(),
  roomId: z.number(),
  floor: z.string(),
  title: z
    .string()
    .min(3, "Name should be at least 3 characters")
    .max(150, "Name shouldn't be more than 150 characters"),
  mobile: z
    .string()
    .min(10, "Mobile number should be 10-digit only.")
    .max(10, "Mobile number should be 10-digit only."),
  description: z.string(),
  feedback: z.string(),
  img: z.string(),
  rating: z.number(),
  resolvedAt: z.string().datetime(),
  assignedTo: z.number(),
  coAssignedTo: z.number(),
  status: z.number(),
  staffNote: z.string(),
  raisedFor: z.number(),
  raisedBy: z.number(),
  raisedById: z.number(),
  closingRemarks: z.string(),
  reopenReason: z.string(),
  createdAt: z.string().datetime(),
  updatedAt: z.string().datetime(),
});

type complaintsTypes = z.infer<typeof complaintsSchema>;

export const addComplaintSchema = z.object({
  title: complaintsSchema.shape.title,
  description: complaintsSchema.shape.description,
});
export const addComplaintFeedbackSchema = z.object({
  feedback: complaintsSchema.shape.feedback,
  rating: complaintsSchema.shape.rating,
});
export const assignComplaintSchema = z.object({
  complaintId: complaintsSchema.shape.id,
  staffId: staffsSchema.shape.id,
});
export const updateStatusSchema = z.object({
  complaintId: complaintsSchema.shape.id,
  status: complaintsSchema.shape.status,
});
export const addFeedbackSchema = z.object({
  complaintId: complaintsSchema.shape.id,
  feedback: complaintsSchema.shape.feedback,
  rating: complaintsSchema.shape.rating,
});

export default complaintsTypes;
