import { createCrudRoutes } from '../../utils/generic-crud.routes';
import { Organization } from '../../modules/organization/organization.entity';
import { OrganizationSchema, CreateOrganizationDto, UpdateOrganizationDto } from '../../modules/organization/organization.schema';
import { authMiddleware } from '../../middleware/auth.middleware';

const organizationRoutes = createCrudRoutes({
  entity: Organization,
  createSchema: CreateOrganizationDto,
  updateSchema: UpdateOrganizationDto,
  getSchema: OrganizationSchema,
  listSchema: OrganizationSchema,
  searchFields: ['name'],
  middleware: [authMiddleware],
  userTracking: {
    createdByField: 'created_by',
    updatedByField: 'updated_by'
  }
});

export default organizationRoutes;