package thb.jeanluc.adventure.loader;

import thb.jeanluc.adventure.loader.dto.ConditionDto;
import thb.jeanluc.adventure.loader.dto.EndingDto;
import thb.jeanluc.adventure.model.Ending;

/** Builds {@link Ending} objects from {@link EndingDto}s. */
public final class EndingFactory {

    private EndingFactory() {
    }

    public static Ending fromDto(EndingDto dto) {
        return new Ending(
                dto.id(),
                dto.title(),
                Boolean.TRUE.equals(dto.victory()),
                ConditionDto.toModelList(dto.when()),
                dto.text());
    }
}
