package com.style24.front.biz.web;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.style24.front.biz.service.TsfKollusService;
import com.style24.front.support.controller.TsfBaseController;
import com.style24.persistence.domain.KollusResult;

import lombok.extern.slf4j.Slf4j;

import com.gagaframework.web.rest.server.GagaResponse;

/**
 * Kollus Upload Controller (카테노이드 동영상 업로드)
 *
 * @author gagamel
 * @since 2021. 4. 16
 */
@Controller
@RequestMapping("/kollus")
@Slf4j
public class TsfKollusUploadController extends TsfBaseController {

	@Autowired
	private TsfKollusService kollusService;

	/**
	 * 상품 동영상 업로드 결과
	 * @author gagamel
	 * @since 2021. 4. 16
	 */
	@RequestMapping("/goods/upload/result")
	@ResponseBody
	public GagaResponse updateGoodsVideoResult(KollusResult result) {
		log.info("{}", result);

		if (StringUtils.isNotBlank(result.getMedia_content_key()) && StringUtils.isNotBlank(result.getUpload_file_key())) {
			kollusService.updateGoodsVideoResult(result);
		}

		return super.ok();
	}

	/**
	 * 리뷰 동영상 업로드 결과
	 * @author gagamel
	 * @since 2021. 4. 16
	 */
	@RequestMapping("/review/upload/result")
	@ResponseBody
	public GagaResponse updateReviewVideoResult(KollusResult result) {
		log.info("{}", result);

		if (StringUtils.isNotBlank(result.getMedia_content_key()) && StringUtils.isNotBlank(result.getUpload_file_key())) {
			kollusService.updateReviewVideoResult(result);
		}

		return super.ok();
	}

	/**
	 * 전시 동영상 업로드 결과
	 * @author gagamel
	 * @since 2021. 4. 16
	 */
	@RequestMapping("/display/upload/result")
	@ResponseBody
	public GagaResponse updateDisplayVideoResult(KollusResult result) {
		log.info("{}", result);

		if (StringUtils.isNotBlank(result.getMedia_content_key()) && StringUtils.isNotBlank(result.getUpload_file_key())) {
			kollusService.updateDisplayVideoResult(result);
		}

		return super.ok();
	}

	/**
	 * 상품 상세 동영상 업로드 결과
	 * @author eskim
	 * @since 2021. 7. 15
	 */
	@RequestMapping("/goods/desc/upload/result")
	@ResponseBody
	public GagaResponse updateGoodsDescVideoResult(KollusResult result) {
		log.info("{}", result);

		if (StringUtils.isNotBlank(result.getMedia_content_key()) && StringUtils.isNotBlank(result.getUpload_file_key())) {
			kollusService.updateGoodsDescVideoResult(result);
		}

		return super.ok();
	}
}
