import { z } from "zod";
import { roomsSchema } from "./room.schema";

export const propertiesSchema = z.object({
  id: z.number(),
  parentId: z.number().nullable(),
  gId: z.string(),
  name: z.string(),
  clientId: z.number(),
  ownerName: z.string(),
  ownerMobile: z.string(),
  ownerEmail: z.string(),
  address: z.string(),
  streetAddress: z.string(),
  pincode: z.string(),
  longitude: z.string(),
  latitude: z.string(),
  locationId: z.number(),
  type: z.number(),
  source: z.number(),
  floorCount: z.number().nullable(),
  isGroundIncluded: z.number(),
  rentalCycle: z.string(),
  gracePeriod: z.number(),
  fine: z.number(),
  fineType: z.number(),
  tenantPreference: z.number(),
  security: z.number(),
  agreementPeriod: z.number(),
  noticePeriod: z.number(),
  lockInPeriod: z.number(),
  status: z.number(),
  bankId: z.number(),
  isPoliceVerificationEnabled: z.number(),
  isRentAgreementEnabled: z.number(),
  isPartialPaymentEnabled: z.number(),
  isIdVerificationEnabled: z.number(),
  isPanVerificationEnabled: z.number(),
  businessName: z.string(),
  gstNo: z.string(),
  payuMid: z.string(),
  payuKey: z.string(),
  isOnlinePaymentEnabled: z.number(),
  paymentGateway: z.number(),
  isVisibleOnWebsite: z.number(),
  isFoodEnabled: z.number(),
  isStampPaperRequired: z.number(),
  wifiPassword: z.string(),
  createdAt: z.string().datetime(),
  updatedAt: z.string().datetime(),
});

export const basicDetailsSchema = z.object({
  propertyName: propertiesSchema.shape.name,
  ownerName: propertiesSchema.shape.ownerName,
  ownerMobile: propertiesSchema.shape.ownerMobile,
  // city: propertiesSchema.shape.address,
  address: propertiesSchema.shape.streetAddress,
  type: propertiesSchema.shape.type,
  floorCount: propertiesSchema.shape.floorCount,
  isGroundIncluded: propertiesSchema.shape.isGroundIncluded,
});

export const tenantAgreementSchema = z.object({
  tenantPreference: propertiesSchema.shape.tenantPreference,
  securityDeposit: propertiesSchema.shape.security,
  agreementPeriod: propertiesSchema.shape.agreementPeriod,
  noticePeriod: propertiesSchema.shape.noticePeriod,
  lockInPeriod: propertiesSchema.shape.lockInPeriod,
  propId: propertiesSchema.shape.id,
});

export const rentDetailsSchema = z.object({
  rentalCycle: propertiesSchema.shape.rentalCycle,
  gracePeriod: propertiesSchema.shape.gracePeriod,
  fine: propertiesSchema.shape.fine,
  fineType: propertiesSchema.shape.fineType,
  propId: propertiesSchema.shape.id,
});

export const duplicateFloorSchema = z.object({
  floor: roomsSchema.shape.floor,
  propId: propertiesSchema.shape.id,
  floors: z.array(roomsSchema.shape.floor),
});

export const makeActiveSchema = z.object({
  propId: propertiesSchema.shape.id,
});

export const deactivateSchema = z.object({
  propId: propertiesSchema.shape.id,
});

export const editNameSchema = z.object({
  propId: propertiesSchema.shape.id,
  name: propertiesSchema.shape.name,
});

type propertiesTypes = z.infer<typeof propertiesSchema>;

export default propertiesTypes;
