package com.zhentao.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhentao.entity.MatchmakerSuccessCaseUpload;
import com.zhentao.mapper.MatchmakerSuccessCaseUploadMapper;
import com.zhentao.service.MatchmakerSuccessCaseUploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * 红娘上传成功案例Service实现
 */
@Slf4j
@Service
public class MatchmakerSuccessCaseUploadServiceImpl 
        extends ServiceImpl<MatchmakerSuccessCaseUploadMapper, MatchmakerSuccessCaseUpload> 
        implements MatchmakerSuccessCaseUploadService {

    @Override
    public boolean submitSuccessCase(MatchmakerSuccessCaseUpload upload) {
        // 设置默认值
        upload.setAuditStatus(0); // 待审核
        upload.setPointsReward(0);
        upload.setCashReward(new java.math.BigDecimal("0.00"));
        upload.setRewardStatus(0); // 未发放
        upload.setIsPublished(0); // 未发布
        upload.setCreatedAt(LocalDateTime.now());
        upload.setUpdatedAt(LocalDateTime.now());
        
        log.info("提交成功案例: matchmakerId={}, maleUserId={}, femaleUserId={}", 
                upload.getMatchmakerId(), upload.getMaleUserId(), upload.getFemaleUserId());
        
        return this.save(upload);
    }
}
