package vn.azteam.tpf.service.mapper;

import vn.azteam.tpf.domain.*;
import vn.azteam.tpf.service.dto.TBActivityTypeDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity TBActivityType and its DTO TBActivityTypeDTO.
 */
@Mapper(componentModel = "spring", uses = {TBDetailUserMapper.class, TBCustomerMapper.class})
public interface TBActivityTypeMapper extends EntityMapper<TBActivityTypeDTO, TBActivityType> {

    @Mapping(source = "deletedBy.id", target = "deletedById")
    @Mapping(source = "createdBy.id", target = "createdById")
    @Mapping(source = "modifiedBy.id", target = "modifiedById")
    @Mapping(source = "customer.id", target = "customerId")
    @Mapping(target = "deletedImages", ignore = true)
    TBActivityTypeDTO toDto(TBActivityType tBActivityType);

    @Mapping(source = "deletedById", target = "deletedBy")
    @Mapping(source = "createdById", target = "createdBy")
    @Mapping(source = "modifiedById", target = "modifiedBy")
    @Mapping(source = "customerId", target = "customer")
    TBActivityType toEntity(TBActivityTypeDTO tBActivityTypeDTO);

    default TBActivityType fromId(Long id) {
        if (id == null) {
            return null;
        }
        TBActivityType tBActivityType = new TBActivityType();
        tBActivityType.setId(id);
        return tBActivityType;
    }
}
