import { RecipeInstructionStepDto } from "../api/dtos/RecipeInstructionStepDto.js";
import { RecipeInstructionStepEntity } from "../entities/RecipeInstructionStepEntity.js";
import { AbstractDtoEntityMapper } from "./AbstractDtoEntityMapper.js";

export class RecipeInstructionStepDtoEntityMapper extends AbstractDtoEntityMapper<RecipeInstructionStepEntity,RecipeInstructionStepDto>{
    toDto(entity: RecipeInstructionStepEntity): RecipeInstructionStepDto {
        const dto = new RecipeInstructionStepDto();
        this.mapBaseEntityToDto(entity, dto);

        dto.text = entity.text;
        dto.sortOrder = entity.sortOrder        

        return dto;
    }

  toEntity(dto: RecipeInstructionStepDto): RecipeInstructionStepEntity {
    const entity = new RecipeInstructionStepEntity();
    this.mapBaseDtoToEntity(dto, entity);


    entity.text = dto.text;
    entity.sortOrder = dto.sortOrder

    return entity;
  }

  createNewEntity(): RecipeInstructionStepEntity {
    return new RecipeInstructionStepEntity();
  }

  mergeDtoIntoEntity(dto: RecipeInstructionStepDto, entity: RecipeInstructionStepEntity): RecipeInstructionStepEntity {
    entity.text = dto.text;
    entity.sortOrder = dto.sortOrder;
    return entity;
  }

}