package me.chyxion.tigon.service;

import me.chyxion.tigon.form.BaseFormForCreateApi;
import me.chyxion.tigon.form.BaseFormForUpdateApi;
import me.chyxion.tigon.model.BaseModel;
import me.chyxion.tigon.model.ViewModel;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * @version 0.0.1
 * @since 0.0.1
 * @author Shaun Chyxion <br>
 * chyxion@163.com <br>
 * Jun 21, 2016 10:02:10 AM
 */
public interface BaseCrudByFormService
    <PrimaryKey, Model extends BaseModel<PrimaryKey>,
        FormForCreate extends BaseFormForCreateApi,
        FormForUpdate extends BaseFormForUpdateApi<PrimaryKey>>
    extends BaseCrudService<PrimaryKey, Model>,
        BaseQueryService<PrimaryKey, Model>,
    BaseDeleteService<PrimaryKey> {

    /**
     * @param form form
     * @return view model
     */
    @NotNull ViewModel<Model> create(@NotNull @Valid FormForCreate form);

    /**
     * @param form form
     * @return view model
     */
    @NotNull ViewModel<Model> update(@NotNull @Valid FormForUpdate form);

}
