import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { BidsService } from '../../services/bids.service';
import { CreateBidDto } from '../../dto/bid/create-bid.dto';
import { BidHistoriesService } from '../../services/bid-histories.service';
import { CreateBidHistoryDto } from '../../dto/bid-history/create-bid-history.dto';
import { Bid } from '../../entities/bid.entity';
import { AuctionHistoresApi } from '../../apis/auction-histories.api';

@Controller('admin/bid-histories')
export class AdminBidHistoriesController {
  constructor(
    private readonly bidHistoriesService: BidHistoriesService,
    private readonly auctionHistoresApi: AuctionHistoresApi,
  ) {}

  @Post()
  create(@Body() data: CreateBidHistoryDto) {
    return this.bidHistoriesService.create(data);
  }

  @Get('detail/:lot_id')
  async getBidHistories(@Param('lot_id') lot_id: Bid['lot_id']) {
    return await this.auctionHistoresApi.getHistoriesBid(lot_id);
  }
}
