package com.arms.api.report.weekly.model.vo;

import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;

@Getter
@NoArgsConstructor
public class StateMappingResponse {

    private List<StateMappingInfo.Category> categories;
    private List<StateMappingInfo.State> states;
    private List<StateMappingInfo.AlmIssueStatus> almIssueStatuses;

    public StateMappingInfo toStateMappingInfo() {
        return StateMappingInfo.builder()
                .categoryMap(categories.stream()
                        .collect(Collectors.toMap(StateMappingInfo.Category::getId, Function.identity())))
                .stateMap(states.stream()
                        .collect(Collectors.toMap(StateMappingInfo.State::getId, Function.identity())))
                .almIssueStatusMap(almIssueStatuses.stream()
                        .collect(Collectors.toMap(StateMappingInfo.AlmIssueStatus::getId, Function.identity())))
                .build();
    }
}
