
package cn.orionsec.ops.mapping.app;

import cn.orionsec.kit.lang.utils.convert.TypeStore;
import cn.orionsec.ops.constant.Const;
import cn.orionsec.ops.constant.app.ApplicationEnvAttr;
import cn.orionsec.ops.entity.domain.ApplicationEnvDO;
import cn.orionsec.ops.entity.vo.app.ApplicationEnvVO;

public class ApplicationEnvConversion {

    static {
        TypeStore.STORE.register(ApplicationEnvDO.class, ApplicationEnvVO.class, p -> {
            ApplicationEnvVO vo = new ApplicationEnvVO();
            vo.setId(p.getId());
            vo.setAppId(p.getAppId());
            vo.setProfileId(p.getProfileId());
            vo.setKey(p.getAttrKey());
            vo.setValue(p.getAttrValue());
            vo.setDescription(p.getDescription());
            vo.setUpdateTime(p.getUpdateTime());
            Integer forbidDelete = ApplicationEnvAttr.of(p.getAttrKey()) == null ? Const.FORBID_DELETE_CAN : Const.FORBID_DELETE_NOT;
            vo.setForbidDelete(forbidDelete);
            return vo;
        });
    }

}
