import { Injectable } from '@nestjs/common';
import { ActivityType, PaymentMethod, ProductCategory } from '@prisma/client';
import { CALENDAR_EVENT_TYPES } from '../calendar/dto/create-calendar-event.dto';
import { CONTACT_LIFECYCLES } from '../contacts/contact.constants';
import { DEAL_STAGES, ENGAGEMENT_MODELS, LOSS_REASONS, OPEN_DEAL_STAGES, STAGE_LABEL, STAGE_PROBABILITY } from '../deals/deal.constants';
import { EDITABLE_LEAD_STATUSES, LEAD_SOURCES, SERVICE_INTERESTS } from '../leads/lead.constants';
import { GST_RATES, PRODUCT_UNITS } from '../products/product.constants';
import { BUDGET_TYPES, PROJECT_STATUSES } from '../projects/dto/create-project.dto';
import { TASK_PRIORITIES, TASK_TYPES } from '../tasks/dto/create-task.dto';

@Injectable()
export class OptionsService {
  /** Returns every fixed choice list the API validates against, so the UI never keeps its own copy. */
  getOptions() {
    return {
      leadSources: [...LEAD_SOURCES],
      defaultServices: [...SERVICE_INTERESTS],
      leadStatuses: [...EDITABLE_LEAD_STATUSES],
      dealStages: DEAL_STAGES.map((stage) => ({ value: stage, label: STAGE_LABEL[stage], probability: STAGE_PROBABILITY[stage], isOpen: OPEN_DEAL_STAGES.includes(stage) })),
      engagementModels: [...ENGAGEMENT_MODELS],
      lossReasons: [...LOSS_REASONS],
      contactLifecycles: [...CONTACT_LIFECYCLES],
      projectStatuses: [...PROJECT_STATUSES],
      budgetTypes: [...BUDGET_TYPES],
      taskTypes: [...TASK_TYPES],
      taskPriorities: [...TASK_PRIORITIES],
      calendarEventTypes: [...CALENDAR_EVENT_TYPES],
      activityTypes: Object.values(ActivityType),
      productCategories: Object.values(ProductCategory),
      productUnits: [...PRODUCT_UNITS],
      gstRates: [...GST_RATES],
      paymentMethods: Object.values(PaymentMethod),
    };
  }
}
