import { createCrudRoutes } from '@d8d/shared-crud';
import { authMiddleware } from '@d8d/auth-module-mt';
import { AdvertisementType } from '../entities/advertisement-type.entity';
import { AdvertisementTypeSchema, CreateAdvertisementTypeDto, UpdateAdvertisementTypeDto } from '../schemas/advertisement-type.schema';

export const advertisementTypeRoutes = createCrudRoutes({
  entity: AdvertisementType,
  createSchema: CreateAdvertisementTypeDto,
  updateSchema: UpdateAdvertisementTypeDto,
  getSchema: AdvertisementTypeSchema,
  listSchema: AdvertisementTypeSchema,
  searchFields: ['name', 'code'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'createdBy',
    updatedByField: 'updatedBy'
  },
  tenantOptions: {
    enabled: true,
    tenantIdField: 'tenantId'
  }
});