import { Document, Types } from 'mongoose';

import { IPaginateModel } from '@/shared/interfaces/model.interface';
import { AuditFields } from '@/shared/types/common';
import { PaymentType, Status } from '@/shared/constants/enum.constant';

// Base PaymentPlan Interface (Clean & concise)
export interface IPaymentPlanBase {
  name: string;
  project: Types.ObjectId;
  downPayment: number;
  downPaymentType: PaymentType;
  companyId: Types.ObjectId;
  status: Status;
  ratePerSqYd: number;
  installmentMonth: number;
}

export interface IPaymentPlan extends IPaymentPlanBase, AuditFields {}

export interface IPaymentPlanDoc extends IPaymentPlan, Document {}

export interface IPaymentPlanModel extends IPaginateModel<IPaymentPlanDoc> {
  isPaymentPlanNameTaken(name: string): Promise<boolean>;
}

export type NewCreatedPaymentPlan = IPaymentPlanBase &
  Partial<Pick<AuditFields, 'createdBy' | 'updatedBy'>>;
export type UpdatePaymentPlanBody = Partial<IPaymentPlan>;
