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

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

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

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

	@Override
	public AidsVO entityVO(Aids aids) {
		AidsVO aidsVO = Objects.requireNonNull(BeanUtil.copy(aids, AidsVO.class));

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

		return aidsVO;
	}

}
