/*-
 * ~~~~~~licensing~~~~~~
 * schema-api
 * ==========
 * Copyright (C) 2020 - 2021 EmDev LLC
 * ==========
 * 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.
 * ~~~~~~/licensing~~~~~~
 */
package ru.entaxy.esb.platform.runtime.core.infrastructure.schema.api;

import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.api.entity.Resource;
import ru.entaxy.esb.platform.runtime.core.infrastructure.schema.api.entity.ResourceInfo;

import java.util.List;
import java.util.Optional;

public interface ResourceService {

    long loadResource(Resource resource);

    long reloadResource(Resource resource);

    Optional<Resource> getResource(long id);

    Optional<Resource> getResourceByNamespace(String namespace);

    Optional<Resource> getResourceByName(String name);

    Optional<Resource> getResourceByIdAndVersion(long id, String version);

    void removeResource(long id);

    long loadResourceInfo(ResourceInfo resourceInfo);

    long editResourceInfo(ResourceInfo resourceInfo);

    Optional<ResourceInfo> getResourceInfo(long id);

    Optional<ResourceInfo> getResourceInfoByNamespace(String namespace);

    Optional<ResourceInfo> getResourceInfoByName(String name);

    Optional<ResourceInfo> getResourceInfoByIdAndVersion(long id, String version);

    void removeResourceInfo(long id);

    List<ResourceInfo> getListResourceInfo();

    List<ResourceInfo> getListResourceInfoByName(String name);

    List<ResourceInfo> getListResourceInfoByNamespace(String namespace);

}
