package com.rf.psychological.douyin.service;

import com.rf.psychological.douyin.model.DouYinOrderEntity;
import com.rf.psychological.enums.OrderStatus;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;

import java.util.List;

/**
 * @Description:订单
 * @Author: mimang
 * @Date: 2023/8/17
 */
@ConditionalOnProperty(prefix="douyin",name = "isDouYin", havingValue = "true")
public interface DouYinOrderService {
    /**
     * 获取订单
     * @param resultId 结果Id
     * @param type 支付状态
     * @return
     */
    DouYinOrderEntity findByResultIdAndStatus(String resultId, String type);

    /**
     * 创建新的新订单
     * @param totalAmount 金额
     * @param subject 描述
     * @param body 详情
     * @param resultId 结果Id
     * @return
     */
    DouYinOrderEntity createNewOrder(int totalAmount, String subject, String body, String resultId);

    void updateOrder(DouYinOrderEntity orderInfo);

    DouYinOrderEntity findByOutOrderNo(String orderNo);

    /**
     * 根据订单状态获取到所有订单
     * @param notpay
     * @return
     */
    List<DouYinOrderEntity> findAllByStatus(OrderStatus notpay);
    /**
     * 判断是否支付
     * @param resultId
     * @return
     */
    boolean checkPayOrder(String resultId);

    void deleteByNo(String outOrderNo);
}
