/*
 * This file is part of the Yildiz-Engine project, licenced under the MIT License  (MIT)
 *
 * Copyright (c) 2017 Grégory Van den Borre
 *
 * More infos available: https://www.yildiz-games.be
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the "Software"), to deal in the Software without restriction, including without
 * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
 * OR COPYRIGHT  HOLDERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE  SOFTWARE.
 */

package be.yildiz.shared.protocol.response;

import be.yildiz.module.network.exceptions.InvalidNetworkMessage;
import be.yildiz.module.network.protocol.MessageWrapper;
import be.yildiz.module.network.protocol.NetworkMessage;
import be.yildiz.module.network.protocol.ServerResponse;
import be.yildiz.shared.mission.MissionId;
import be.yildiz.shared.mission.MissionStatus;
import be.yildiz.shared.mission.task.TaskStatus;
import be.yildiz.shared.mission.task.TaskStatusList;

import java.util.Collection;
import java.util.List;

/**
 * @author Grégory Van den Borre
 */
public class MissionStatusResponse extends NetworkMessage implements ServerResponse {

    private final MissionId missionId;

    private final MissionStatus status;

    private final Collection<TaskStatus> tasks;

    /**
     * Full constructor, parse the message to build the object.
     *
     * @param message Message received from the server.
     * @throws InvalidNetworkMessage in case of error while parsing the message.
     */
    public MissionStatusResponse(final MessageWrapper message) throws InvalidNetworkMessage {
        super(message);
        this.missionId = new MissionId(this.getInt());
        try {
            this.status = MissionStatus.valueOf(this.getInt());
            this.tasks = this.to(TaskStatusList.class).getList();
        }catch (AssertionError e) {
            throw new InvalidNetworkMessage("Invalid mission status", e);
        }
    }

    public MissionStatusResponse(final MissionId id, MissionStatus status, List<TaskStatus> tasks) {
        super(NetworkMessage.convertParams(id, status, NetworkMessage.from(new TaskStatusList(tasks), TaskStatusList.class)));
        this.missionId = id;
        this.status = status;
        this.tasks = tasks;
    }

    @Override
    public int command() {
        return ServerCommand.MISSION_STATUS.value;
    }

    public MissionId getMissionId() {
        return missionId;
    }

    public MissionStatus getStatus() {
        return status;
    }

    public Collection<TaskStatus> getTasks() {
        return this.tasks;
    }

}

@@ -1782,19 +1782,18 @@
 va.util.
-Lis
+Se
 t;%0A%0A/**%0A
@@ -2789,19 +2789,18 @@
 status, 
-Lis
+Se
 t%3CTaskSt

Use set instead of list.