package com.artfess.manage.dwd.manager.mapper;

import com.artfess.manage.dwd.manager.dto.DwdSjWeatherPhenoMiDto;
import com.artfess.manage.dwd.model.DwdSjWeatherPhenoMi;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    date = "2023-05-08T09:35:56+0800",
    comments = "version: 1.2.0.Final, compiler: javac, environment: Java 1.8.0_71 (Oracle Corporation)"
)
@Component
public class DwdSjWeatherPhenoMiDtoMapperImpl implements DwdSjWeatherPhenoMiDtoMapper {

    @Override
    public DwdSjWeatherPhenoMi toEntity(DwdSjWeatherPhenoMiDto dto) {
        if ( dto == null ) {
            return null;
        }

        DwdSjWeatherPhenoMi dwdSjWeatherPhenoMi = new DwdSjWeatherPhenoMi();

        dwdSjWeatherPhenoMi.setId( dto.getId() );
        dwdSjWeatherPhenoMi.setName( dto.getName() );
        dwdSjWeatherPhenoMi.setPath( dto.getPath() );
        dwdSjWeatherPhenoMi.setTimezone( dto.getTimezone() );
        dwdSjWeatherPhenoMi.setTimezoneOffset( dto.getTimezoneOffset() );
        dwdSjWeatherPhenoMi.setText( dto.getText() );
        dwdSjWeatherPhenoMi.setCode( dto.getCode() );
        dwdSjWeatherPhenoMi.setTemperature( dto.getTemperature() );
        dwdSjWeatherPhenoMi.setLastUpdate( dto.getLastUpdate() );
        dwdSjWeatherPhenoMi.setInsertTime( dto.getInsertTime() );
        dwdSjWeatherPhenoMi.setAreaId( dto.getAreaId() );
        if ( dto.getUpdateTime() != null ) {
            dwdSjWeatherPhenoMi.setUpdateTime( DateTimeFormatter.ISO_LOCAL_DATE_TIME.format( dto.getUpdateTime() ) );
        }

        return dwdSjWeatherPhenoMi;
    }

    @Override
    public DwdSjWeatherPhenoMiDto toDto(DwdSjWeatherPhenoMi entity) {
        if ( entity == null ) {
            return null;
        }

        DwdSjWeatherPhenoMiDto dwdSjWeatherPhenoMiDto = new DwdSjWeatherPhenoMiDto();

        if ( entity.getUpdateTime() != null ) {
            dwdSjWeatherPhenoMiDto.setUpdateTime( java.time.LocalDateTime.parse( entity.getUpdateTime() ) );
        }
        dwdSjWeatherPhenoMiDto.setId( entity.getId() );
        dwdSjWeatherPhenoMiDto.setName( entity.getName() );
        dwdSjWeatherPhenoMiDto.setPath( entity.getPath() );
        dwdSjWeatherPhenoMiDto.setTimezone( entity.getTimezone() );
        dwdSjWeatherPhenoMiDto.setTimezoneOffset( entity.getTimezoneOffset() );
        dwdSjWeatherPhenoMiDto.setText( entity.getText() );
        dwdSjWeatherPhenoMiDto.setCode( entity.getCode() );
        dwdSjWeatherPhenoMiDto.setTemperature( entity.getTemperature() );
        dwdSjWeatherPhenoMiDto.setLastUpdate( entity.getLastUpdate() );
        dwdSjWeatherPhenoMiDto.setInsertTime( entity.getInsertTime() );
        dwdSjWeatherPhenoMiDto.setAreaId( entity.getAreaId() );

        return dwdSjWeatherPhenoMiDto;
    }

    @Override
    public List<DwdSjWeatherPhenoMi> toEntity(List<DwdSjWeatherPhenoMiDto> dtoList) {
        if ( dtoList == null ) {
            return null;
        }

        List<DwdSjWeatherPhenoMi> list = new ArrayList<DwdSjWeatherPhenoMi>( dtoList.size() );
        for ( DwdSjWeatherPhenoMiDto dwdSjWeatherPhenoMiDto : dtoList ) {
            list.add( toEntity( dwdSjWeatherPhenoMiDto ) );
        }

        return list;
    }

    @Override
    public List<DwdSjWeatherPhenoMiDto> toDto(List<DwdSjWeatherPhenoMi> entityList) {
        if ( entityList == null ) {
            return null;
        }

        List<DwdSjWeatherPhenoMiDto> list = new ArrayList<DwdSjWeatherPhenoMiDto>( entityList.size() );
        for ( DwdSjWeatherPhenoMi dwdSjWeatherPhenoMi : entityList ) {
            list.add( toDto( dwdSjWeatherPhenoMi ) );
        }

        return list;
    }
}
