package com.cool.store.service.close.impl;

import com.cool.store.dao.StoreDao;
import com.cool.store.entity.StoreDO;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.service.close.AccountCloseStrategy;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * <p>
 * 账号关闭
 * </p>
 *
 * @author wangff
 * @since 2025/10/8
 */
public abstract class AbstractAccountClose implements AccountCloseStrategy {
    @Resource
    private StoreDao storeDao;

    @Override
    public Boolean accountClose(String storeId) {
        // 各平台待对接
        return true;
    }

    protected StoreDO getStore(String storeId) {
        StoreDO storeDO = storeDao.getByStoreId(storeId);
        if (Objects.isNull(storeDO)) {
            throw new ServiceException(ErrorCodeEnum.STORE_NOT_FIND);
        }
        return storeDO;
    }
}
