/*
 * Copyright 2015-2018 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */
package org.docksidestage.app.web.wx.rmshowbase;

import javax.annotation.Resource;

import org.docksidestage.app.web.base.FortressBaseAction;
import org.docksidestage.remote.maihama.showbase.wx.RemoteMaihamaShowbaseWxBhv;
import org.docksidestage.remote.maihama.showbase.wx.remogen.method.RemoteWxRemogenMethodGetReturn;
import org.docksidestage.remote.maihama.showbase.wx.remogen.routing.resola.RemoteWxRemogenRoutingResolaReturn;
import org.lastaflute.web.Execute;
import org.lastaflute.web.login.AllowAnyoneAccess;
import org.lastaflute.web.response.JsonResponse;

/**
 * @author jflute
 */
@AllowAnyoneAccess
public class WxRmshowbaseRemogenAction extends FortressBaseAction {

    @Resource
    private RemoteMaihamaShowbaseWxBhv showbaseWxBhv;

    // ===================================================================================
    //                                                                             Execute
    //                                                                             =======
    // -----------------------------------------------------
    //                                               Routing
    //                                               -------
    // http://localhost:8151/fortress/wx/rmshowbase/remogen/resola
    @Execute
    public JsonResponse<RemoteWxRemogenRoutingResolaReturn> resola() {
        RemoteWxRemogenRoutingResolaReturn ret = showbaseWxBhv.requestRemogenRoutingResola(1);
        return asJson(ret);
    }

    // -----------------------------------------------------
    //                                             Rare Case
    //                                             ---------
    // http://localhost:8151/fortress/wx/rmshowbase/remogen/getenclosing
    @Execute
    public JsonResponse<RemoteWxRemogenMethodGetReturn> getenclosing() {
        RemoteWxRemogenMethodGetReturn ret = showbaseWxBhv.requestRemogenMethodEnclosingGet(param -> {
            param.sea = "mystic";
            param.land = 83;
        }, rule -> {});
        return asJson(ret);
    }
}

@@ -2667,11 +2667,454 @@
 );%0A    %7D
+%0A%0A    // preparing #for_now%0A    //// http://localhost:8151/fortress/wx/rmshowbase/remogen/deleteenclosing%0A    //@Execute%0A    //public JsonResponse%3CRemoteWxRemogenMethodDeleteReturn%3E deleteenclosing() %7B%0A    //    RemoteWxRemogenMethodDeleteReturn ret = showbaseWxBhv.requestRemogenMethodEnclosingDelete(param -%3E %7B%0A    //        param.sea = %22mystic%22;%0A    //        param.land = 83;%0A    //    %7D, rule -%3E %7B%7D);%0A    //    return asJson(ret);%0A    //%7D
 %0A%7D%0A

test DELETE with entity-enclosing