package com.red.circle.console.app.convertor;

import com.red.circle.console.app.dto.clienobject.admin.ComboUserCO;
import com.red.circle.console.app.dto.clienobject.admin.UserCO;
import com.red.circle.console.app.dto.clienobject.admin.UserDetailsCO;
import com.red.circle.console.app.dto.clienobject.admin.UserRoleCO;
import com.red.circle.console.app.dto.clienobject.user.InviteUserRewardRecordCO;
import com.red.circle.console.app.dto.clienobject.user.SpecialIdLogCO;
import com.red.circle.console.app.dto.clienobject.user.UserBeautifulNumberApplyCO;
import com.red.circle.console.app.dto.clienobject.user.UserCheckInLogCO;
import com.red.circle.console.app.dto.clienobject.user.UserPasswordLogCO;
import com.red.circle.console.app.dto.clienobject.user.UserProfileDetailCO;
import com.red.circle.console.app.dto.cmd.admin.AccountInfoCmd;
import com.red.circle.console.app.dto.cmd.admin.UserCmd;
import com.red.circle.console.infra.database.rds.dto.admin.UserRoleDTO;
import com.red.circle.console.infra.database.rds.entity.admin.User;
import com.red.circle.console.inner.model.dto.AdminUserDTO;
import com.red.circle.framework.core.convertor.ConvertorModel;
import com.red.circle.other.inner.model.dto.sys.SysUserSpecialIdLogDTO;
import com.red.circle.other.inner.model.cmd.user.UserBaseInfoCmd;
import com.red.circle.other.inner.model.cmd.user.UserProfileUpdateCmd;
import com.red.circle.other.inner.model.cmd.user.UserSpecialIdCmd;
import com.red.circle.other.inner.model.dto.user.InviteUserRewardRecordDTO;
import com.red.circle.other.inner.model.dto.user.PasswordLogDTO;
import com.red.circle.other.inner.model.dto.user.UserBeautifulNumberApplyDTO;
import com.red.circle.other.inner.model.dto.user.UserCheckInLogDTO;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import com.red.circle.other.inner.model.dto.user.UserSpecialIdDTO;
import java.util.List;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

/**
 * @author pengliang on 2023/5/12
 */
@Mapper(componentModel = ConvertorModel.SPRING)
public interface UserAppConvertor {

  User toUser(AccountInfoCmd cmd);

  @Mappings({
      @Mapping(target = "status", expression = "java(com.red.circle.console.infra.database.rds.enums.StatusEnum.toEnum(cmd.getStatus()))"),
  })
  User toUser(UserCmd cmd);

  @Mappings({
      @Mapping(target = "status", expression = "java(user.getStatus().getValue())"),
  })
  UserCO toUserCO(User user);

  @Mappings({
      @Mapping(target = "status", expression = "java(user.getStatus().getValue())"),
  })
  ComboUserCO toComboUserCO(User user);

  UserDetailsCO toUserDetailsCO(User user);

  List<UserRoleCO> toListUserRoleCO(List<UserRoleDTO> userRoles);

  AdminUserDTO toAdminUserCO(User user);

  InviteUserRewardRecordCO toInviteUserRewardRecordCO(InviteUserRewardRecordDTO dto);

  UserProfileDetailCO toUserProfileDetailCO(UserProfileDTO dto);

  UserBaseInfoCmd toUserBaseInfoCmd(UserProfileUpdateCmd cmd);

  UserBeautifulNumberApplyCO toUserBeautifulNumberApplyCO(UserBeautifulNumberApplyDTO dto);

  UserCheckInLogCO toUserCheckInLogCO(UserCheckInLogDTO dto);

  UserSpecialIdCmd toUserSpecialIdCmd(UserSpecialIdDTO dto);

  SpecialIdLogCO toSpecialIdLogCO(SysUserSpecialIdLogDTO dto);

  UserPasswordLogCO toUserPasswordLogCO(PasswordLogDTO passwordLog);
}
