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

import com.cool.store.entity.StoreDO;
import com.cool.store.request.xgj.XgjAccountCloseRequest;
import com.cool.store.service.ThirdXgjService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * <p>
 * 新掌柜账号关闭
 * </p>
 *
 * @author wangff
 * @since 2025/10/8
 */
@Service
@RequiredArgsConstructor
public class XinguanjiaAccountClose extends AbstractAccountClose {
    private final ThirdXgjService thirdXgjService;

    @Override
    public String getSystemCode() {
        return "xinguanjia";
    }

    @Override
    public Boolean accountClose(String storeId) {
        StoreDO storeDO = getStore(storeId);
        String closeTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        thirdXgjService.accountClose(new XgjAccountCloseRequest(storeDO.getStoreNum(), closeTime));
        return true;
    }
}
