import { Controller, Get, Query } from '@nestjs/common';
import { EmsService } from './ems.service';
import { GetImagesDTO } from './dto/get-images';
import { GetFiguresDTO } from './dto/get-figures';

@Controller('ems')
export class EmsController {
    constructor(private readonly emsService: EmsService) { }

    @Get('/regions')//✅
    async getRegions() {
        return this.emsService.getTypeRoles()
    }

    @Get('/images')//✅
    async getImages(@Query() getImagesDTO: GetImagesDTO) {
        const { city_id, limit, offset } = getImagesDTO
        return this.emsService.getImages(city_id, offset, limit)
    }

    @Get('/figures')
    async getFigures(@Query() getFiguresDTO: GetFiguresDTO) {
        const { offset, limit, year, city_id } = getFiguresDTO
        return this.emsService.getFigures(year, city_id, offset, limit)
    }
}
