package com.ga.core.mapper.commission;

import com.ga.core.vo.commission.JointContractResp;
import com.ga.core.vo.commission.JointContractSearchParam;
import com.ga.core.vo.commission.JointContractVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * joint_contract Mapper.
 * 공동계약: 복수 설계사의 계약별 지분율 관리.
 */
@Mapper
public interface JointContractMapper {

    JointContractResp selectById(@Param("jointId") Long jointId);

    List<JointContractResp> selectList(JointContractSearchParam param);

    /**
     * 계약별 공동설계사 목록 조회 — 지분율 확인용.
     */
    List<JointContractResp> selectByContract(@Param("contractId") Long contractId);

    /**
     * 계약별 지분율 합산 — 합=1 검증(Service 가드) 용도.
     */
    BigDecimal sumShareByContract(@Param("contractId") Long contractId);

    int insert(JointContractVO vo);

    int update(JointContractVO vo);

    int delete(@Param("jointId") Long jointId);
}
