package com.zksy.property.service.impl;

import com.zksy.property.domain.dto.ContractFormDTO;
import com.zksy.property.domain.dto.ReceiptDto;
import com.zksy.property.service.AContractInfoService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@SpringBootTest
class AContractInfoServiceImplTest {


    @Autowired
    private AContractInfoService aContractInfoService;

    @Test
    void signContract() {
        ContractFormDTO dto = new ContractFormDTO();
        dto.setHouseId("637a5298e3a076ab80fd695f5435a3a9");
        var map = new HashMap<String, Object>();
        map.put("tenantName", "123");
        map.put("landlordName", "123");
        map.put("tenantTimeStart", "2025-07-17");
        map.put("tenantTime", "123");
        map.put("tenantTimeEnd", "2028-07-17");
        map.put("tenantRent", "123");
        map.put("tenantDeposit", "123");
        map.put("tenantDepositAmount", "123");
        dto.setContractData(map);

        var obj = new ContractFormDTO.RentalInfo();
        obj.setRentalName("刘昊林");
        obj.setRentalIdCard("123456789");
        obj.setRentalPhone("456789123");
        obj.setRentalTimeStart("2025-07-17");
        obj.setRentalTime("18个月");
        obj.setRentalRect("9.9");
        dto.setRentalInfo(obj);
        aContractInfoService.signContract(dto);
    }

    @Test
    void LeaseAgreement() {
        ContractFormDTO dto = new ContractFormDTO();
        dto.setHouseId("e23a5d808fd71d2ec5b0b5867b379bc9");
            Map<String, Object> leaseMap = new HashMap<>();
            leaseMap.put("purpose", "123");
            leaseMap.put("landlordName", "123");
            leaseMap.put("landlordUniCode", "123");
            leaseMap.put("landlordLegalRepresentative", "123");
            leaseMap.put("landlordDuty", "123");
            leaseMap.put("tenantName", "123");
            leaseMap.put("tenantUniCode", "123");
            leaseMap.put("tenantLegalRepresentative", "123");
            leaseMap.put("tenantDuty", "123");
            leaseMap.put("who", "123");
            leaseMap.put("whatTime", "123");
            leaseMap.put("title", "123");
            leaseMap.put("supportingRoomArea", "123");
            leaseMap.put("officeArea", "123");
            leaseMap.put("canteenArea", "123");
            leaseMap.put("totalLeasedArea", "123");
            leaseMap.put("dormTotalRooms", "123");
            leaseMap.put("dormSmallRooms", "123");
            leaseMap.put("dormLargeRooms", "123");
            leaseMap.put("deliveryDate", "123");
            leaseMap.put("productionProject", "123");
            leaseMap.put("leaseTermYears", "123");
            leaseMap.put("leaseStartDate", "123");
            leaseMap.put("leaseEndDate", "123");
            leaseMap.put("renewNoticeMonths", "123");
            leaseMap.put("factorySpecificFloor1", "123");
            leaseMap.put("rentPerSqmFloor1", "123");
            leaseMap.put("factorySpecificFloor2", "123");
            leaseMap.put("rentPerSqmFloor2", "123");
            leaseMap.put("factoryAnnualRent", "123");
            leaseMap.put("supportingRoomRentPerSqm", "123");
            leaseMap.put("supportingRoomAnnualRent", "123");
            leaseMap.put("dormSmallRoomRent", "123");
            leaseMap.put("dormLargeRoomRent", "123");
            leaseMap.put("dormAnnualRent", "123");
            leaseMap.put("totalAnnualRent", "123");
            leaseMap.put("propertyFeePerSqm", "123");
            leaseMap.put("factorySupportingPropertyFee", "123");
            leaseMap.put("dormSmallRoomPropertyFee", "123");
            leaseMap.put("dormLargeRoomPropertyFee", "123");
            leaseMap.put("dormAnnualPropertyFee", "123");
            leaseMap.put("totalAnnualPropertyFee", "123");
            leaseMap.put("annualTotalRentAndPropertyFee", "123");
            leaseMap.put("depositAmount", "123");
            dto.setContractData(leaseMap);

        aContractInfoService.signContract(dto);
    }
    @Test
    void LeaseAgreementC() {
        ContractFormDTO dto = new ContractFormDTO();
        dto.setHouseId("36dfa5c6672273740f0ce88e1c966af0");
            Map<String, Object> leaseMap = new HashMap<>();
            leaseMap.put("contractNumber", "123");
            leaseMap.put("lessorName", "123");
            leaseMap.put("lessorLegalRep", "123");
            leaseMap.put("lessorUniCode", "123");
            leaseMap.put("lesseeName", "123");
            leaseMap.put("lesseeLegalRep", "123");
            leaseMap.put("lesseeIdCode", "123");
            leaseMap.put("propertyLocation", "123");
            leaseMap.put("rentableArea", "123");
            leaseMap.put("usableArea", "123");
            leaseMap.put("sharedArea", "123");
            leaseMap.put("propertyUseNature", "123");
            leaseMap.put("storeName", "123");
            leaseMap.put("brand", "123");
            leaseMap.put("businessScope", "123");
            leaseMap.put("leaseTermMonths", "123");
            leaseMap.put("leaseStartDate", "123");
            leaseMap.put("leaseEndDate", "123");
            leaseMap.put("renovationStartDate", "123");
            leaseMap.put("renovationEndDate", "123");
            leaseMap.put("officialLeaseStartDate", "123");
            leaseMap.put("annualRentLower", "123");
            leaseMap.put("annualPropertyFeeLower", "123");
            leaseMap.put("depositAmount", "123");
            dto.setContractData(leaseMap);
        aContractInfoService.signContract(dto);
    }

    @Test
    void getReceipt(){
        var dto = new ReceiptDto(
                "1",
                "1",
                new BigDecimal(1),
                new BigDecimal(1),
                new BigDecimal(1),
                new BigDecimal(1),
                new BigDecimal(1),
                "1",
                "2025-07-29",
                "2025-07-29"
        );
        String receipt = aContractInfoService.getReceipt("31c7f3fdfc236328bce3307645d566dd",dto);
        System.out.println(receipt);
    }

}