import { Document, Types } from 'mongoose';
import { IPaginateModel } from '@/shared/interfaces/model.interface';
import { AuditFields } from '@/shared/types/common';
import { TimelineStatus } from './timeline.constant';

// Photo Interface
export interface IPhoto {
  photoUrl: string;
  caption?: string;
}

// Base Interface
export interface ITimelineBase {
  label: string;
  startDate: Date;
  progress: number;
  endDate: Date;
  status: TimelineStatus;
  photos: IPhoto[];
  project: Types.ObjectId;
}

// Main Interface with audit fields
export interface ITimeline extends ITimelineBase, AuditFields {}

// Mongoose Document Interface
export interface ITimelineDoc extends ITimeline, Document {}

// Mongoose Model Interface
export interface ITimelineModel extends IPaginateModel<ITimelineDoc> {}

export type NewCreatedTimeline = ITimelineBase &
  Partial<Pick<AuditFields, 'createdBy' | 'updatedBy'>>;

export type UpdateTimelineBody = Partial<ITimeline>;

export interface ITimelineFilter {
  project?: Types.ObjectId | string;
  status?: string;
  search?: string;
  startDate?: Date;
  endDate?: Date;
  year?: number | string;
}
