import { BaseAgent } from "./base-agent";
import { AgentSchema } from "./schemas";

// TaskAgent data based on BDI framework and metadata
export const taskAgentData = {
  metadata: {
    name: "TaskAgent",
    role: "Task management specialist",
    purpose: "Handle task allocation and execution",
    goals: [
      "Efficient task processing",
      "Resource optimization",
      "Performance maintenance"
    ],
    rules: [
      "Must verify task prerequisites",
      "Must follow resource allocation policies",
      "Must maintain task priorities"
    ],
    tools: [
      "Task management system",
      "Resource allocation tools",
      "Performance monitoring",
      "Reporting system"
    ],
    interactions: [
      "Reports to CoordinatorAgent",
      "Collaborates with ValidationAgent",
      "Coordinates with ExecutionAgent"
    ],
    lifecycle_roles: {
      initialization: "Setup task management parameters",
      operation: "Process tasks",
      maintenance: "Optimize task handling",
      termination: "Complete pending tasks"
    }
  },
  bdi: {
    beliefs: [
      "Current task states",
      "Resource availability",
      "System capabilities",
      "Performance requirements"
    ],
    desires: [
      "Optimize task execution",
      "Maintain efficient resource usage",
      "Meet performance targets",
      "Ensure task completion"
    ],
    intentions: [
      "Process task requests",
      "Allocate resources",
      "Monitor execution",
      "Handle completions"
    ]
  }
};

export class TaskAgent extends BaseAgent {
  constructor(agentData = taskAgentData) {
    super(agentData);
  }

  // Example: get all current beliefs
  getCurrentBeliefs() {
    return this.beliefs;
  }

  // Example: get all intentions
  getCurrentIntentions() {
    return this.intentions;
  }
}

// Usage example
const taskAgent = new TaskAgent();
console.log("TaskAgent goals:", taskAgent.getGoals());
console.log("TaskAgent beliefs:", taskAgent.getCurrentBeliefs());
console.log("TaskAgent intentions:", taskAgent.getCurrentIntentions());
console.log("Is valid:", taskAgent.validate().success);