package com.caliverse.admin.domain.api;

import com.caliverse.admin.domain.request.LogGenericRequest;
import com.caliverse.admin.domain.response.DictionaryResponse;
import com.caliverse.admin.domain.service.MetaDataService;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Tag(name = "백과사전", description = "백과사전 api")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/v1/dictionary")
public class DictionaryController {
    private final MetaDataService metaDataService;

    @GetMapping("/brand/list")
    public ResponseEntity<DictionaryResponse> brandList(){
        return ResponseEntity.ok().body( metaDataService.getBrandList());
    }

    @GetMapping("/item/list")
    public ResponseEntity<DictionaryResponse> itemList(
            @RequestParam Map<String, String> requestParams){
        return ResponseEntity.ok().body( metaDataService.getItemDictList(requestParams));
    }

    @GetMapping("/item/excel-export")
    public void itemExcelExport(HttpServletResponse response,
                                @RequestParam Map<String, String> requestParams){
        metaDataService.itemExcelExport(response, requestParams);
    }
}
