package com.red.circle.external.adapter.app;

import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
import com.red.circle.tool.core.collection.CollectionUtils;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pengliang on 2024/1/15
 */
@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/test-external", produces = MediaType.APPLICATION_JSON_VALUE)
public class TestExternalRestController {


  @GetMapping("/i18n")
  public Map<String, String> i18n() {
    Map<String, String> body = CollectionUtils.newHashMap();

    Locale locale = org.springframework.util.StringUtils.parseLocale("en");

    body.put("title",
        OfficialNoticeTypeEnum.REFUSE_BD_LEADER_INVITE_AGENT.getTitle(locale));

    Map<String, String> params = new HashMap<>();
    params.put("userProfile", "t1");
    params.put("test", "t2");
    body.put("body", OfficialNoticeTypeEnum.REFUSE_BD_LEADER_INVITE_AGENT.getBodyFormat(locale,
        params));
    return body;
  }

}
