EquipmentTypeCommandMapperImpl.java

package com.github.jenkaby.bikerental.equipment.web.command.mapper;

import com.github.jenkaby.bikerental.equipment.application.usecase.CreateEquipmentTypeUseCase;
import com.github.jenkaby.bikerental.equipment.application.usecase.UpdateEquipmentTypeUseCase;
import com.github.jenkaby.bikerental.equipment.web.command.dto.EquipmentTypeRequest;
import com.github.jenkaby.bikerental.equipment.web.command.dto.EquipmentTypeUpdateRequest;
import javax.annotation.processing.Generated;
import org.springframework.stereotype.Component;

@Generated(
    value = "org.mapstruct.ap.MappingProcessor",
    comments = "version: 1.6.3, compiler: IncrementalProcessingEnvironment from gradle-language-java-9.4.1.jar, environment: Java 21.0.10 (Amazon.com Inc.)"
)
@Component
public class EquipmentTypeCommandMapperImpl implements EquipmentTypeCommandMapper {

    @Override
    public CreateEquipmentTypeUseCase.CreateEquipmentTypeCommand toCreateCommand(EquipmentTypeRequest request) {
        if ( request == null ) {
            return null;
        }

        String slug = null;
        String name = null;
        String description = null;

        slug = request.slug();
        name = request.name();
        description = request.description();

        CreateEquipmentTypeUseCase.CreateEquipmentTypeCommand createEquipmentTypeCommand = new CreateEquipmentTypeUseCase.CreateEquipmentTypeCommand( slug, name, description );

        return createEquipmentTypeCommand;
    }

    @Override
    public UpdateEquipmentTypeUseCase.UpdateEquipmentTypeCommand toUpdateCommand(String slug, EquipmentTypeUpdateRequest request) {
        if ( slug == null && request == null ) {
            return null;
        }

        String name = null;
        String description = null;
        if ( request != null ) {
            name = request.name();
            description = request.description();
        }
        String slug1 = null;
        slug1 = slug;

        UpdateEquipmentTypeUseCase.UpdateEquipmentTypeCommand updateEquipmentTypeCommand = new UpdateEquipmentTypeUseCase.UpdateEquipmentTypeCommand( slug1, name, description );

        return updateEquipmentTypeCommand;
    }
}