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

// Base Interface
export interface IPaymentTermBase {
  name: string;
  stage: string;
  triggerType: PaymentTerms;
  triggerValue: number;
  documentTemplate: Types.ObjectId;
  paymentPlans: Types.ObjectId[];
  status: Status;
  sendEmail: boolean;
  sendSMS: boolean;
  project: Types.ObjectId;
}

// Main Interface with audit fields
export interface IPaymentTerm extends IPaymentTermBase, AuditFields {}

// Mongoose Document Interface
export interface IPaymentTermDoc extends IPaymentTerm, Document {}

// Mongoose Model Interface
export interface IPaymentTermModel extends IPaginateModel<IPaymentTermDoc> {}

export type NewCreatedPaymentTerm = IPaymentTermBase &
  Partial<Pick<AuditFields, 'createdBy' | 'updatedBy'>>;

export type UpdatePaymentTermBody = Partial<IPaymentTerm>;

