/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.person.wrapper;

import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.person.entity.FertileWoman;
import org.springblade.person.entity.HouseUser;
import org.springblade.person.service.HouseUserService;
import org.springblade.person.vo.FertileWomanVO;
import java.util.Objects;

/**
 * 包装类,返回视图层所需的字段
 *
 * @author BladeX
 * @since 2021-05-28
 */
public class FertileWomanWrapper extends BaseEntityWrapper<FertileWoman, FertileWomanVO>  {

	private HouseUserService houseUserService;
	public FertileWomanWrapper(){}
	public static FertileWomanWrapper build() {
		return new FertileWomanWrapper();
 	}

 	public FertileWomanWrapper(HouseUserService houseUserService){this.houseUserService = houseUserService;}
 	public static FertileWomanWrapper build(HouseUserService houseUserService){
		return new FertileWomanWrapper(houseUserService);
	}

	@Override
	public FertileWomanVO entityVO(FertileWoman fertileWoman) {
		FertileWomanVO fertileWomanVO = Objects.requireNonNull(BeanUtil.copy(fertileWoman, FertileWomanVO.class));

		HouseUser houseUser = houseUserService.getById(fertileWoman.getParentId());
		fertileWomanVO.setAgencyId(houseUser.getAgencyId());
		fertileWomanVO.setAgencyName(houseUser.getAgencyName());
		fertileWomanVO.setBirthday(houseUser.getBirthday());
		fertileWomanVO.setBuildingId(houseUser.getBuildingId());
		fertileWomanVO.setBuildingName(houseUser.getBuildingName());
		fertileWomanVO.setResidentialId(houseUser.getResidentialId());
		fertileWomanVO.setResidentialName(houseUser.getResidentialName());
		fertileWomanVO.setFloorId(houseUser.getFloorId());
		fertileWomanVO.setFloorName(houseUser.getFloorName());
		fertileWomanVO.setResidentialName(houseUser.getFloorName());
		fertileWomanVO.setRoomId(houseUser.getRoomId());
		fertileWomanVO.setRoomName(houseUser.getRoomName());
		fertileWomanVO.setPhone(houseUser.getPhone());
		fertileWomanVO.setIdCard(houseUser.getIdCard());
		fertileWomanVO.setSex(houseUser.getSex());
		fertileWomanVO.setNation(houseUser.getNation());
		fertileWomanVO.setNativePlace(houseUser.getNativePlace());
		fertileWomanVO.setNationality(houseUser.getNationality());
		fertileWomanVO.setEntryImgUri(houseUser.getEntryImgUri());
		fertileWomanVO.setPassportImgUri(houseUser.getPassportImgUri());
		fertileWomanVO.setPolitical(houseUser.getPolitical());
		fertileWomanVO.setMaritalStatus(houseUser.getMaritalStatus());
		fertileWomanVO.setEducationalLevel(houseUser.getEducationalLevel());
		fertileWomanVO.setWorkplace(houseUser.getWorkplace());
		fertileWomanVO.setEmail(houseUser.getEmail());
		fertileWomanVO.setTags(houseUser.getTags());
		fertileWomanVO.setRemark(houseUser.getRemark());
		fertileWomanVO.setCreateType(houseUser.getCreateType());
		fertileWomanVO.setType(houseUser.getType());
		fertileWomanVO.setImageMd5(houseUser.getImageMd5());
		fertileWomanVO.setImageUri(houseUser.getFaceUrl());
		fertileWomanVO.setCheckState(houseUser.getAuditStatus());
		fertileWomanVO.setFaceEnable(houseUser.getFaceEnable());
		fertileWomanVO.setFaceBeginDate(houseUser.getFaceBeginDate());
		fertileWomanVO.setFaceEndDate(houseUser.getFaceEndDate());
		fertileWomanVO.setOldId(houseUser.getOldId());
		fertileWomanVO.setRegionProvince(houseUser.getRegionProvince());
		fertileWomanVO.setRegionCity(houseUser.getRegionCity());
		fertileWomanVO.setRegionArea(houseUser.getRegionArea());
		fertileWomanVO.setUnitId(houseUser.getUnitId());
		fertileWomanVO.setUnitName(houseUser.getName());

		return fertileWomanVO;
	}

}
