import { objectId } from '@/shared/validations/custom.validation';
import Joi from 'joi';

export const getReports = {
  query: Joi.object().keys({
    type: Joi.string(),
    role: Joi.string(),
    sortBy: Joi.string(),
    limit: Joi.number().integer().min(1),
    page: Joi.number().integer().min(-1),
    includeTimeStamps: Joi.boolean(),
    // Sales Summary Report specific validations
    userType: Joi.string().valid('broker', 'builder'),
    startDate: Joi.date(),
    endDate: Joi.date(),
    assignedTo: Joi.string(),
    activityType: Joi.string(),
    status: Joi.string(),
    source: Joi.string(),
    sourceId: Joi.string().custom(objectId),
    leadStage: Joi.string(),
    leadStageId: Joi.string().custom(objectId),
    projectId: Joi.string().custom(objectId),
    propertyId: Joi.string().custom(objectId),
    categoryId: Joi.string().custom(objectId),
    subCategoryId: Joi.string().custom(objectId),
    dateRange: Joi.string().valid(
      'last_month',
      'last_6_months',
      'last_3_months',
      'this_month',
      'custom',
    ),
    view: Joi.string().valid('all', 'closed', 'open', 'overview', 'detail'),
  }),
};
