package tech.easyflow.system.service;

import com.mybatisflex.core.service.IService;
import org.springframework.web.multipart.MultipartFile;
import tech.easyflow.common.entity.LoginAccount;
import tech.easyflow.system.entity.SysAccount;
import tech.easyflow.system.entity.vo.SysAccountBatchActionResultVo;
import tech.easyflow.system.entity.vo.SysAccountImportResultVo;

import java.io.OutputStream;
import java.math.BigInteger;
import java.util.Collection;
import java.util.Map;

/**
 * 用户表 服务层。
 *
 * @author ArkLight
 * @since 2025-03-14
 */
public interface SysAccountService extends IService<SysAccount> {

    /**
     * 批量解析账号展示名称。
     *
     * @param accountIds 账号 ID 集合
     * @return 账号 ID 到展示名称的映射，名称优先使用昵称，其次登录名，最后回退为 ID 字符串
     */
    Map<BigInteger, String> resolveDisplayNameMap(Collection<BigInteger> accountIds);

    void syncRelations(SysAccount entity);

    SysAccount getByUsername(String userKey);

    void resetPassword(BigInteger accountId, BigInteger operatorId);

    SysAccountBatchActionResultVo removeBatchWithResult(Collection<BigInteger> ids);

    SysAccountBatchActionResultVo resetPasswordBatch(Collection<BigInteger> ids, BigInteger operatorId);

    SysAccountImportResultVo importAccounts(MultipartFile file, LoginAccount loginAccount);

    void writeImportTemplate(OutputStream outputStream);
}
