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

import com.artfess.manage.dwd.manager.dto.DwdSjWeatherForcastMiDto;
import com.artfess.manage.dwd.model.DwdSjWeatherForcastMi;
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 DwdSjWeatherForcastMiDtoMapperImpl implements DwdSjWeatherForcastMiDtoMapper {

    @Override
    public DwdSjWeatherForcastMi toEntity(DwdSjWeatherForcastMiDto dto) {
        if ( dto == null ) {
            return null;
        }

        DwdSjWeatherForcastMi dwdSjWeatherForcastMi = new DwdSjWeatherForcastMi();

        dwdSjWeatherForcastMi.setDate( dto.getDate() );
        dwdSjWeatherForcastMi.setTextDay( dto.getTextDay() );
        dwdSjWeatherForcastMi.setCodeDay( dto.getCodeDay() );
        dwdSjWeatherForcastMi.setTextNight( dto.getTextNight() );
        dwdSjWeatherForcastMi.setCodeNight( dto.getCodeNight() );
        dwdSjWeatherForcastMi.setHigh( dto.getHigh() );
        dwdSjWeatherForcastMi.setLow( dto.getLow() );
        dwdSjWeatherForcastMi.setPrecip( dto.getPrecip() );
        dwdSjWeatherForcastMi.setWindDirection( dto.getWindDirection() );
        dwdSjWeatherForcastMi.setWindDirectionDegree( dto.getWindDirectionDegree() );
        dwdSjWeatherForcastMi.setWindSpeed( dto.getWindSpeed() );
        dwdSjWeatherForcastMi.setWindScale( dto.getWindScale() );
        dwdSjWeatherForcastMi.setRainfall( dto.getRainfall() );
        dwdSjWeatherForcastMi.setHumidity( dto.getHumidity() );
        dwdSjWeatherForcastMi.setInsertTime( dto.getInsertTime() );
        if ( dto.getUpdateTime() != null ) {
            dwdSjWeatherForcastMi.setUpdateTime( DateTimeFormatter.ISO_LOCAL_DATE_TIME.format( dto.getUpdateTime() ) );
        }
        dwdSjWeatherForcastMi.setId( dto.getId() );

        return dwdSjWeatherForcastMi;
    }

    @Override
    public DwdSjWeatherForcastMiDto toDto(DwdSjWeatherForcastMi entity) {
        if ( entity == null ) {
            return null;
        }

        DwdSjWeatherForcastMiDto dwdSjWeatherForcastMiDto = new DwdSjWeatherForcastMiDto();

        if ( entity.getUpdateTime() != null ) {
            dwdSjWeatherForcastMiDto.setUpdateTime( java.time.LocalDateTime.parse( entity.getUpdateTime() ) );
        }
        dwdSjWeatherForcastMiDto.setDate( entity.getDate() );
        dwdSjWeatherForcastMiDto.setTextDay( entity.getTextDay() );
        dwdSjWeatherForcastMiDto.setCodeDay( entity.getCodeDay() );
        dwdSjWeatherForcastMiDto.setTextNight( entity.getTextNight() );
        dwdSjWeatherForcastMiDto.setCodeNight( entity.getCodeNight() );
        dwdSjWeatherForcastMiDto.setHigh( entity.getHigh() );
        dwdSjWeatherForcastMiDto.setLow( entity.getLow() );
        dwdSjWeatherForcastMiDto.setPrecip( entity.getPrecip() );
        dwdSjWeatherForcastMiDto.setWindDirection( entity.getWindDirection() );
        dwdSjWeatherForcastMiDto.setWindDirectionDegree( entity.getWindDirectionDegree() );
        dwdSjWeatherForcastMiDto.setWindSpeed( entity.getWindSpeed() );
        dwdSjWeatherForcastMiDto.setWindScale( entity.getWindScale() );
        dwdSjWeatherForcastMiDto.setRainfall( entity.getRainfall() );
        dwdSjWeatherForcastMiDto.setHumidity( entity.getHumidity() );
        dwdSjWeatherForcastMiDto.setInsertTime( entity.getInsertTime() );
        dwdSjWeatherForcastMiDto.setId( entity.getId() );

        return dwdSjWeatherForcastMiDto;
    }

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

        List<DwdSjWeatherForcastMi> list = new ArrayList<DwdSjWeatherForcastMi>( dtoList.size() );
        for ( DwdSjWeatherForcastMiDto dwdSjWeatherForcastMiDto : dtoList ) {
            list.add( toEntity( dwdSjWeatherForcastMiDto ) );
        }

        return list;
    }

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

        List<DwdSjWeatherForcastMiDto> list = new ArrayList<DwdSjWeatherForcastMiDto>( entityList.size() );
        for ( DwdSjWeatherForcastMi dwdSjWeatherForcastMi : entityList ) {
            list.add( toDto( dwdSjWeatherForcastMi ) );
        }

        return list;
    }
}
