class WorkspaceImpl {

    @NotNull
    public static String createWorkspaceBody(TerraformWorkspaceInputs createWorkspaceInputs, String delimiter) {
        String requestBody = EMPTY;
        final List<String> triggerPrefixesList = new ArrayList<>();
        ObjectMapper createWorkspaceMapper = new ObjectMapper();
        CreateWorkspaceRequestBody createBody = new CreateWorkspaceRequestBody();
        CreateWorkspaceRequestBody.CreateWorkspaceData createWorkspaceData = createBody.new CreateWorkspaceData();
        CreateWorkspaceRequestBody.Attributes attributes = createBody.new Attributes();
        attributes.setName(createWorkspaceInputs.getWorkspaceName());
        attributes.setTerraform_version(createWorkspaceInputs.getCommonInputs().getTerraformVersion());
        attributes.setDescription(createWorkspaceInputs.getWorkspaceDescription());
        attributes.setAutoApply(Boolean.parseBoolean(createWorkspaceInputs.getAutoApply()));
        attributes.setFileTriggersEnabled(Boolean.parseBoolean(createWorkspaceInputs.getFileTriggersEnabled()));
        attributes.setWorkingDirectory(createWorkspaceInputs.getWorkingDirectory());
        attributes.setQueueAllRuns(Boolean.parseBoolean(createWorkspaceInputs.getQueueAllRuns()));
        attributes.setSpeculativeEnabled(Boolean.parseBoolean(createWorkspaceInputs.getSpeculativeEnabled()));
        String[] triggerPrefixes = createWorkspaceInputs.getTriggerPrefixes().split(delimiter);
        Collections.addAll(triggerPrefixesList, triggerPrefixes);
        attributes.setTriggerPrefixes(triggerPrefixesList);

        CreateWorkspaceRequestBody.VCSRepo vcsRepo = createBody.new VCSRepo();

        vcsRepo.setIdentifier(createWorkspaceInputs.getVcsRepoId());
        vcsRepo.setOauthTokenId(createWorkspaceInputs.getOauthTokenId());
        vcsRepo.setBranch(createWorkspaceInputs.getVcsBranch());
        vcsRepo.setIngressSubmodules(Boolean.parseBoolean(createWorkspaceInputs.getIngressSubmodules()));

        attributes.setVcsRepo(vcsRepo);

        createWorkspaceData.setAttributes(attributes);
        createWorkspaceData.setType(WORKSPACE_TYPE);

        createBody.setData(createWorkspaceData);


        try {
            requestBody = createWorkspaceMapper.writeValueAsString(createBody);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        return requestBody;

    }

}