package com.gic.haoban.manage.service.service.out.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.KeyDataDTO;
import com.gic.haoban.manage.api.enums.KeyDataEnum;
import com.gic.haoban.manage.api.service.KeyDataApiService;
import com.gic.haoban.manage.service.pojo.bo.hm.KeyDataMobileBO;
import com.gic.haoban.manage.service.service.KeyDataService;

@Service("keyDataApiService")
public class KeyDataApiServiceImpl implements KeyDataApiService {

    @Autowired
    private KeyDataService keyDataService;

    @Override
    public ServiceResponse<String> saveMobileData(String enterpiseId, String linkShortCode, String mobile) {
        KeyDataMobileBO bo = new KeyDataMobileBO();
        bo.setMobile(mobile);
        KeyDataDTO keyData = this.keyDataService.saveData(enterpiseId, linkShortCode, JSON.toJSONString(bo),
                KeyDataEnum.MOBILE);
        return ServiceResponse.success(keyData.getDataKey());
    }
}
