package com.axelor.apps.purchase.web;

import com.axelor.apps.purchase.db.ImportationFolder;
import com.axelor.apps.purchase.service.ImportationFolderService;
import com.axelor.exception.AxelorException;
import com.axelor.inject.Beans;
import com.axelor.rpc.ActionRequest;
import com.axelor.rpc.ActionResponse;
import com.google.inject.Singleton;

@Singleton
public class ImportationFolderController {
    public void draftImportationFolder(ActionRequest request, ActionResponse response) {
        ImportationFolder importationFolder = request.getContext().asType(ImportationFolder.class);
        Beans.get(ImportationFolderService.class).draftImportationFolder(importationFolder);
    }

    public void openImportationFolder(ActionRequest request, ActionResponse response) throws AxelorException {
        ImportationFolder importationFolder = request.getContext().asType(ImportationFolder.class);
        Beans.get(ImportationFolderService.class).openImportationFolder(importationFolder);
    }

    public void closeImportationFolder(ActionRequest request, ActionResponse response) {
        ImportationFolder importationFolder = request.getContext().asType(ImportationFolder.class);
        Beans.get(ImportationFolderService.class).closeImportationFolder(importationFolder);
    }

    public void cancelImportationFolder(ActionRequest request, ActionResponse response) {
        ImportationFolder importationFolder = request.getContext().asType(ImportationFolder.class);
        Beans.get(ImportationFolderService.class).cancelImportationFolder(importationFolder);
    }
}
