package com.seer.teach.mall.convert;

import com.seer.teach.mall.entity.GoodsEntity;
import com.seer.teach.mall.entity.GoodsSpecificationEntity;
import com.seer.teach.mall.response.*;
import com.seer.teach.mall.response.GoodSpuDetailResp;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface GoodsConvert {

    GoodsConvert INSTANCE = Mappers.getMapper(GoodsConvert.class);

    List<CategoryTypeResp> list(List<GoodsEntity> list);

    @Mapping(target = "items", source = "specificationEntities")
    GoodsDetailsResp detail(GoodsEntity goodsEntity, List<GoodsSpecificationEntity> specificationEntities);

    GoodSpuDetailResp one(GoodsEntity goodsEntity);

    GoodsResp convertOne(GoodsEntity goodsEntity);
    List<GoodsResp> convertList(List<GoodsEntity> list);
}
