import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { Supplier } from '../../modules/supplier/supplier.entity';
import { SupplierSchema, CreateSupplierDto, UpdateSupplierDto } from '../../modules/supplier/supplier.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const supplierRoutes = createCrudRoutes({
  entity: Supplier,
  createSchema: CreateSupplierDto,
  updateSchema: UpdateSupplierDto,
  getSchema: SupplierSchema,
  listSchema: SupplierSchema,
  searchFields: ['name', 'username', 'realname'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'created_by',
    updatedByField: 'updated_by'
  }
});

export default supplierRoutes;