package vn.azteam.tpf.service.mapper;

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

import org.mapstruct.*;

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

    @Mapping(source = "createdBy.id", target = "createdById")
    @Mapping(source = "modifiedBy.id", target = "modifiedById")
    @Mapping(source = "deletedBy.id", target = "deletedById")
    TBMaintenanceScheduleDTO toDto(TBMaintenanceSchedule tBMaintenanceSchedule);

    @Mapping(source = "createdById", target = "createdBy")
    @Mapping(source = "modifiedById", target = "modifiedBy")
    @Mapping(source = "deletedById", target = "deletedBy")
    TBMaintenanceSchedule toEntity(TBMaintenanceScheduleDTO tBMaintenanceScheduleDTO);

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