// src/interfaces/project.ts
// Copyright (C) 2026 Rob Colbert <rob.colbert@openplatform.us>
// Licensed under the Apache License, Version 2.0

import type { IUser } from "./user.js";
import type { IAiProvider } from "./ai-provider.ts";

import { GadgetId } from "../lib/gadget-id.ts";
import { HydratedDocument } from "mongoose";
import { ChatSessionMode, IChatSession } from "./chat-session.ts";

export enum ProjectStatus {
  Active = "active",
  Inactive = "inactive",
  Archived = "archived",
}

export interface IProjectSkill {
  _id: GadgetId;
  name: string;
  content: string;
  modes: ChatSessionMode[];
}

export interface IProjectTask {
  _id: GadgetId;
  name: string;
  provider: IAiProvider | GadgetId;
  selectedModel: string;
  mode: ChatSessionMode;
  crontab: string;
  content: string;
  enabled: boolean;
  lastRun: IChatSession | GadgetId;
}

export interface IProject {
  _id: GadgetId;
  createdAt: Date;
  user: IUser | GadgetId;
  status: ProjectStatus;
  name: string;
  slug: string;
  gitUrl?: string;
  description?: string;
  system?: string;
  skills: IProjectSkill[];
  tasks: IProjectTask[];
}

export type ProjectDocument = HydratedDocument<IProject>;
