package org.gcube.application.geoportal.clients;

import com.fasterxml.jackson.core.JsonProcessingException;
import lombok.Data;
import org.bson.Document;
import org.gcube.application.geoportal.client.utils.Serialization;
import org.gcube.application.geoportal.common.model.document.Project;
import org.gcube.application.geoportal.common.model.rest.StepExecutionRequest;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.HandlerDeclaration;
import org.gcube.application.geoportal.common.model.useCaseDescriptor.UseCaseDescriptor;
import org.junit.Test;

import java.rmi.RemoteException;

public class ProfiledConcessioniTest extends ProfiledDocumentsTest{

    @Data
    private static class MyClass {
        private String field;
    }

    @Override
    protected String getUCID() {
        return "profiledConcessioni";
    }

    public void test(){

        UseCaseDescriptor p=null;

        HandlerDeclaration h = p.getHandlersMapByID().get("MyID").get(0);

        Document doc = h.getConfiguration();

        System.out.println(Serialization.convert(doc, MyClass.class));
    }

    @Test
    public void performSubmit() throws RemoteException, JsonProcessingException {
        String id="630f912755e2947b0278c1be";

        Project p = getClient().performStep(id,new StepExecutionRequest("SUBMIT-FOR-REVIEW",new Document()));
        System.out.println("Result is "+Serialization.write(p));
    }


}
