import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { Agent } from '../../modules/agent/agent.entity';
import { AgentSchema, CreateAgentDto, UpdateAgentDto } from '../../modules/agent/agent.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const agentRoutes = createCrudRoutes({
  entity: Agent,
  createSchema: CreateAgentDto,
  updateSchema: UpdateAgentDto,
  getSchema: AgentSchema,
  listSchema: AgentSchema,
  searchFields: ['name', 'username', 'realname', 'phone'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  }
});

export default agentRoutes;