import {
  CoolController,
  BaseController,
  CoolUrlTag,
  TagTypes,
  CoolTag,
} from '@cool-midway/core';
import { Body, Inject, Post } from '@midwayjs/core';
import { PushSorterAppService } from '../../service/sorterapp';

/**
 * 分拣员上报
 */
@CoolUrlTag()
@CoolController()
export class AppPushSorterController extends BaseController {
  @Inject()
  pushSorterAppService: PushSorterAppService;

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/health', { summary: '健康监测上报' })
  async health(@Body() body) {
    return this.ok(await this.pushSorterAppService.reportHealth(body));
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/gps', { summary: 'GPS位置上报' })
  async gps(@Body() body) {
    return this.ok(await this.pushSorterAppService.reportGps(body));
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/siteweightAdd', { summary: '压缩站人工称重上报' })
  async siteweightAdd(@Body() body) {
    return this.ok(await this.pushSorterAppService.addSiteweight(body));
  }

  @CoolTag(TagTypes.IGNORE_TOKEN)
  @Post('/siteweightPage', { summary: '压缩站人工称重记录' })
  async siteweightPage(@Body() body) {
    return this.ok(await this.pushSorterAppService.siteweightPage(body));
  }
}
