package cn.ey.biz.module.system.convert.user;

import cn.ey.biz.common.pojo.PageResult;
import cn.ey.biz.module.system.api.user.dto.AdminLoginUserRespDTO;
import cn.ey.biz.module.system.api.user.dto.AdminUserRespDTO;
import cn.ey.biz.module.system.api.user.dto.UserSyncReqDTO;
import cn.ey.biz.module.system.controller.admin.user.vo.profile.UserProfileRespVO;
import cn.ey.biz.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO;
import cn.ey.biz.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO;
import cn.ey.biz.module.system.controller.admin.user.vo.user.*;
import cn.ey.biz.module.system.dal.dataobject.dept.DeptDO;
import cn.ey.biz.module.system.dal.dataobject.dept.PostDO;
import cn.ey.biz.module.system.dal.dataobject.permission.RoleDO;
import cn.ey.biz.module.system.dal.dataobject.social.SocialUserDO;
import cn.ey.biz.module.system.dal.dataobject.user.AdminUserDO;
import cn.ey.biz.module.system.dal.dataobject.user.AdminUserES;
import cn.ey.biz.module.system.dal.dataobject.user.UserSyncTempDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface UserConvert {

    UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);

    UserPageItemRespVO convert(AdminUserDO bean);

    UserPageItemRespVO.Dept convert(DeptDO bean);

    AdminUserDO convert(UserCreateReqVO bean);

    AdminUserDO convert(UserUpdateReqVO bean);

    UserExcelVO convert02(AdminUserDO bean);

    AdminUserDO convert(UserImportExcelVO bean);

    UserProfileRespVO convert03(AdminUserDO bean);

    List<UserProfileRespVO.Role> convertList(List<RoleDO> list);

    UserProfileRespVO.Dept convert02(DeptDO bean);

    AdminUserDO convert(UserProfileUpdateReqVO bean);

    AdminUserDO convert(UserProfileUpdatePasswordReqVO bean);

    List<UserProfileRespVO.Post> convertList02(List<PostDO> list);

    List<UserProfileRespVO.SocialUser> convertList03(List<SocialUserDO> list);

    List<UserSimpleRespVO> convertList04(List<AdminUserDO> list);

    @Mappings({
            @Mapping(source = "updateTime", target = "updateTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "createTime", target = "createTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(target = "nickname", ignore = true),
            @Mapping(target = "deptId", ignore = true),
            @Mapping(target = "postIds", ignore = true),
            @Mapping(target = "email", ignore = true),
            @Mapping(target = "mobile", ignore = true),
            @Mapping(target = "sex", ignore = true),
            @Mapping(target = "loginIp", ignore = true),
            @Mapping(target = "creator", ignore = true),
            @Mapping(target = "updater", ignore = true),
            @Mapping(target = "personId", ignore = true),
            @Mapping(target = "citizenship", ignore = true),
            @Mapping(target = "secondCitizenship", ignore = true),
            @Mapping(target = "privatePhone", ignore = true),
            @Mapping(target = "countryOfBirth", ignore = true),
            @Mapping(target = "regionOfBirth", ignore = true),
            @Mapping(target = "branch", ignore = true),
            @Mapping(target = "overtimeRlihiniliyy", ignore = true),
            @Mapping(target = "effectiveTime", ignore = true),
            @Mapping(target = "failureTime", ignore = true),
            @Mapping(target = "version", ignore = true)
    })
    AdminUserRespDTO convert4(AdminUserDO bean);

    AdminLoginUserRespDTO convertAdminLoginUserRespDTO(AdminUserDO bean);

    List<AdminUserRespDTO> convertList4(List<AdminUserDO> users);

    PageResult<AdminUserRespDTO> convertPage(PageResult<AdminUserDO> page);

    UserDetailRespVO convertUserDetailRespVO(AdminUserDO bean);

    List<UserDetailRespVO> convertUserDetailRespVOList(List<AdminUserDO> beans);

    List<UserDetailRespVO> convertVoList(List<AdminUserRespDTO> beans);

    PageResult<AdminUserRespDTO> convertAdminUserESPage(PageResult<AdminUserES> page);

    UserSyncTempDO convert(UserSyncReqDTO userSyncReqDTO);
    List<UserSyncTempDO> convertUserSyncTempDOList(List<UserSyncReqDTO> userSyncReqDTO);




}
