package com.ycwl.basic.pricing.service;

import com.ycwl.basic.pricing.dto.BundleProductItem;
import com.ycwl.basic.pricing.entity.PriceBundleConfig;
import org.junit.jupiter.api.Test;

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

import static org.junit.jupiter.api.Assertions.*;

/**
 * 一口价服务测试
 */
class PriceBundleServiceTest {

    @Test
    void testBundleProductItemSerialization() {
        // 测试BundleProductItem对象的创建和序列化
        BundleProductItem item = new BundleProductItem();
        item.setType("PHOTO_PRINT");
        item.setSubType("6寸照片");
        item.setQuantity(20);
        
        assertNotNull(item);
        assertEquals("PHOTO_PRINT", item.getType());
        assertEquals("6寸照片", item.getSubType());
        assertEquals(20, item.getQuantity());
    }
    
    @Test
    void testPriceBundleConfigWithNewStructure() {
        // 测试PriceBundleConfig实体类的新结构
        PriceBundleConfig config = new PriceBundleConfig();
        config.setBundleName("全家福套餐");
        config.setBundlePrice(new BigDecimal("99.00"));
        
        BundleProductItem includedItem = new BundleProductItem();
        includedItem.setType("PHOTO_PRINT");
        includedItem.setSubType("6寸照片");
        includedItem.setQuantity(20);
        
        List<BundleProductItem> includedProducts = List.of(includedItem);
        config.setIncludedProducts(includedProducts);
        
        assertNotNull(config.getIncludedProducts());
        assertEquals(1, config.getIncludedProducts().size());
        assertEquals("PHOTO_PRINT", config.getIncludedProducts().get(0).getType());
    }
}