/**
 * FF AI Agent Projects API Client.
 * Backend: /api/v1/agent/projects (CRUD)
 * AgentSession 通过 query ?projectId=<uuid> 或 ?projectId=null 过滤。
 */

import { createCrudClient } from './_crud-factory';

export interface AgentProject {
  id: string;
  organizationId: string;
  createdById: string;
  name: string;
  icon: string | null;
  color: string | null;
  instructions: string | null;
  createdAt: string;
  updatedAt: string;
}

export interface CreateAgentProjectInput {
  name: string;
  icon?: string;
  color?: string;
  instructions?: string;
}

export interface UpdateAgentProjectInput {
  name?: string;
  icon?: string;
  color?: string;
  instructions?: string;
}

const client = createCrudClient<AgentProject, CreateAgentProjectInput, UpdateAgentProjectInput>(
  '/agent/projects',
);

export const listAgentProjects = () => client.list();
export const createAgentProject = client.create;
export const updateAgentProject = client.update;
export const deleteAgentProject = client.remove;
