/*Copyright (C) 2026 the APIJSON group. All rights reserved.
This source code is licensed under the Apache License Version 2.0.*/
package apijson.orm;
import java.util.List;
import java.util.Map;
import apijson.*;
/**()
* @author Lemon
*/
public interface Verifier {
/**
* @param config
* @return
* @throws Exception
*/
boolean verifyAccess(SQLConfig config) throws Exception;
/**OWNER,CONTACT,ADMIN
* @param config
* @param table
* @param method
* @param role
* @return
* @throws Exception
* @see {@link JSONMap#KEY_ROLE}
*/
void verifyRole(SQLConfig config, String table, RequestMethod method, String role) throws Exception;
/**
* @throws Exception
*/
void verifyLogin() throws Exception;
/**
* @throws Exception
*/
void verifyAdmin() throws Exception;
/**
* @param table
* @param key
* @param value
* @throws Exception
*/
void verifyRepeat(String table, String key, Object value) throws Exception;
/**
* @param table
* @param key
* @param value
* @param exceptId id
* @throws Exception
*/
void verifyRepeat(String table, String key, Object value, long exceptId) throws Exception;
/**
* @param method
* @param name
* @param target
* @param request
* @param maxUpdateCount
* @param database
* @param datasource
* @param namespace
* @param catalog
* @param schema
* @return
* @throws Exception
*/
M verifyRequest(RequestMethod method, String name, M target, M request, int maxUpdateCount
, String database, String datasource, String namespace, String catalog, String schema
) throws Exception;
/**
* @param method
* @param name
* @param target
* @param response
* @param database
* @param schema
* @param parser
* @param callback
* @return
* @throws Exception
*/
M verifyResponse(
RequestMethod method, String name, M target, M response,
String database, String schema, @NotNull Parser parser, OnParseCallback callback
) throws Exception;
@NotNull
Parser createParser();
Parser getParser();
Verifier setParser(AbstractParser parser);
@NotNull
Visitor getVisitor();
Verifier setVisitor(@NotNull Visitor visitor);
String getVisitorIdKey(SQLConfig config);
}