/*
 * Copyright 2017, TeamDev Ltd. All rights reserved.
 *
 * Redistribution and use in source and/or binary forms, with or without
 * modification, must retain the above copyright notice and the following
 * disclaimer.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package org.spine3.server.reflect;

import org.spine3.base.Command;
import org.spine3.base.CommandContext;
import org.spine3.base.Commands;
import org.spine3.base.Failures;
import org.spine3.change.StringChange;
import org.spine3.test.reflect.ProjectId;
import org.spine3.test.reflect.ReflectFailures;
import org.spine3.test.reflect.ReflectFailures.InvalidProjectName;
import org.spine3.test.reflect.command.CreateProject;
import org.spine3.test.reflect.command.UpdateProjectName;
import org.spine3.test.reflect.event.ProjectCreated;

import static org.spine3.base.Identifiers.newUuid;

class Given {

    static class AggregateId {

        private AggregateId() {
        }

        public static ProjectId newProjectId() {
            final String uuid = newUuid();
            return ProjectId.newBuilder()
                            .setId(uuid)
                            .build();
        }
    }

    static class EventMessage {

        private static final ProjectId DUMMY_PROJECT_ID = AggregateId.newProjectId();
        private static final ProjectCreated PROJECT_CREATED = projectCreated(DUMMY_PROJECT_ID);

        private EventMessage() {
        }

        public static ProjectCreated projectCreated() {
            return PROJECT_CREATED;
        }

        public static ProjectCreated projectCreated(ProjectId id) {
            return ProjectCreated.newBuilder()
                                 .setProjectId(id)
                                 .build();
        }
    }

    static class CommandMessage {

        private CommandMessage() {
        }

        public static CreateProject createProject() {
            return CreateProject.newBuilder()
                                .setProjectId(AggregateId.newProjectId())
                                .build();
        }
    }

    static class FailureMessage {

        private static final ProjectId DUMMY_PROJECT_ID = AggregateId.newProjectId();
        private static final InvalidProjectName INVALID_PROJECT_NAME =
                invalidProjectName(DUMMY_PROJECT_ID);

        private FailureMessage() {
        }

        public static InvalidProjectName invalidProjectName() {
            return INVALID_PROJECT_NAME;
        }

        public static InvalidProjectName invalidProjectName(ProjectId id) {
            final InvalidProjectName invalidProjectName =
                    InvalidProjectName.newBuilder()
                                                      .setProjectId(id)
                                                      .build();
            return invalidProjectName;
        }
    }

}

@@ -1050,184 +1050,8 @@
 t;%0A%0A
-import org.spine3.base.Command;%0Aimport org.spine3.base.CommandContext;%0Aimport org.spine3.base.Commands;%0Aimport org.spine3.base.Failures;%0Aimport org.spine3.change.StringChange;%0A
 impo
@@ -1092,56 +1092,8 @@
 Id;%0A
-import org.spine3.test.reflect.ReflectFailures;%0A
 impo
@@ -1213,66 +1213,8 @@
 ct;%0A
-import org.spine3.test.reflect.command.UpdateProjectName;%0A
 impo
@@ -2980,32 +2980,33 @@
 alidProjectName 
+ 
 invalidProjectNa
@@ -3325,11 +3325,10 @@
 %7D%0A    %7D%0A
-%0A
 %7D%0A

Remove unused imports.