import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { GoodsCategory } from '../../modules/goods/goods-category.entity';
import { GoodsCategorySchema, CreateGoodsCategoryDto, UpdateGoodsCategoryDto } from '../../modules/goods/goods-category.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const goodsCategoryRoutes = createCrudRoutes({
  entity: GoodsCategory,
  createSchema: CreateGoodsCategoryDto,
  updateSchema: UpdateGoodsCategoryDto,
  getSchema: GoodsCategorySchema,
  listSchema: GoodsCategorySchema,
  searchFields: ['name'],
  relations: ['imageFile'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'created_by',
    updatedByField: 'updated_by'
  }
});

export default goodsCategoryRoutes;