package com.yeejoin.amos.boot.module.jg.biz.handler.toBeSubmit;

import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.biz.handler.strategy.ToBeSubmitDetailStrategy;
import com.yeejoin.amos.boot.module.jg.biz.service.impl.JgChangeRegistrationTransferServiceImpl;
import com.yeejoin.amos.boot.module.ymt.api.enums.ApplicationFormTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;

@Component
public class RegistrationTransferStrategyHandler implements ToBeSubmitDetailStrategy {

    @Autowired
    private JgChangeRegistrationTransferServiceImpl registrationTransferService;

    @Override
    public Map<String, Map<String, Object>> getDetails(Long sequenceNbr, ReginParams reginParams) {
        Map<String, Map<String, Object>> notice = registrationTransferService.getTransferDetail(String.valueOf(sequenceNbr), reginParams.getCompany());
        Map<String, Object> basic = new HashMap<>();
        basic.put("type", ApplicationFormTypeEnum.YZBG.getBusinessCode());
        basic.put("code", notice.get("equList"));
        basic.put("equCategory", notice.get("EQU_CATEGORY_CODE"));
        basic.put("receiveOrgCreditCode1", notice.get("changeRegistrationTransfer").get("receiveCompanyCode"));
        Map<String, Map<String, Object>> result = new HashMap<>();
        result.put("notice", notice.get("changeRegistrationTransfer"));
        result.put("basic", basic);
        return result;
    }

    @Override
    public String supportBusinessType() {
        return BusinessTypeEnum.JG_CHANGE_REGISTRATION.getName();
    }
}
