import { Injectable } from '@nestjs/common';
import { PrismaService } from '../../common/prisma/prisma.service';

@Injectable()
export class LocalitiesService {
  constructor(private readonly prisma: PrismaService) {}

  list(cityId: number) {
    return this.prisma.locality.findMany({
      where: { cityId, isActive: true },
      orderBy: [{ displayOrder: 'asc' }, { name: 'asc' }],
      select: { localityId: true, name: true, displayOrder: true },
    });
  }
}
