/*
 *      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.EstablishFilecard;
import org.springblade.person.entity.HouseUser;
import org.springblade.person.service.HouseUserService;
import org.springblade.person.vo.EstablishFilecardVO;
import java.util.Objects;

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

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

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

	@Override
	public EstablishFilecardVO entityVO(EstablishFilecard establishFilecard) {
		EstablishFilecardVO establishFilecardVO = Objects.requireNonNull(BeanUtil.copy(establishFilecard, EstablishFilecardVO.class));

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


		return establishFilecardVO;
	}

}
