<?php

Routes::add_api("GET", "/api/download/{id}", ["DownloadController", "get_download"], ["Auth", "can_upload"]);
Routes::add_api("PUT", "/api/download", ["DownloadController", "start_download"], ["Auth", "can_upload"]);
Routes::add_api("GET", "/api/downloads", ["DownloadController", "api_downloads"], ["Auth", "can_upload"]);
Routes::add_api("PUT", "/api/downloads", ["DownloadController", "api_add_download"], ["Auth", "can_upload"]);

Routes::add_api("POST", "/api/document/dragdrop", ["DocumentController", "api_drag_drop"], ["Auth", "can_moderate"]);
Routes::add_api("GET", "/api/document/{id}", ["DocumentController", "api_get"]);
Routes::add_api("POST", "/api/document/{id}", ["DocumentController", "api_set"]);
Routes::add_api("GET", "/api/document/{id}/products", ["DocumentController", "api_get_products"]);

Routes::add_api("GET", "/api/document/{id}/available_metadata", ["DocumentController", "api_available_metadata"]);
Routes::add_api("GET", "/api/document/{id}/metadata", ["DocumentController", "api_get_metadata"]);
Routes::add_api("PUT", "/api/document/{id}/metadata", ["DocumentController", "api_new_metadata"], ["Auth", "can_moderate"]);
Routes::add_api("POST", "/api/document/{id}/metadata/{metadata}", ["DocumentController", "api_set_metadata"], ["Auth", "can_moderate"]);
Routes::add_api("DELETE", "/api/document/{id}/metadata/{metadata}", ["DocumentController", "api_delete_metadata"], ["Auth", "can_moderate"]);

Routes::add_api("DELETE", "/api/product/trash/{id}", ["ProductController", "api_empty_trash"], ["Auth", "can_moderate"]);
Routes::add_api("GET", "/api/product/{list}", ["ProductController", "api_get_list"]);
Routes::add_api("PUT", "/api/product/{id}", ["ProductController", "api_add_child"], ["Auth", "can_moderate"]);
Routes::add_api("POST", "/api/product/{id}", ["ProductController", "api_set"], ["Auth", "can_moderate"]);
routes::add_api("DELETE", "/api/product/{id}", ["ProductController", "api_delete"], ["Auth", "can_moderate"]);

Routes::add_api("GET", "/api/productmru", ["ProductController", "api_get_mru"]);
Routes::add_api("POST", "/api/productmru/{id}", ["ProductController", "api_add_mru"]);
Routes::add_api("POST", "/api/search/product", ["ProductController", "api_search"]);

Routes::add_api("POST", "/api/move/document/{id}", ["DocumentController", "api_move"], ["Auth", "can_moderate"]);
Routes::add_api("POST", "/api/move/product/{id}", ["ProductController", "api_move"], ["Auth", "can_moderate"]);
Routes::add_api("POST", "/api/merge/document/{id}", ["DocumentController", "api_merge"], ["Auth", "can_moderate"]);

Routes::add_api("POST", "/api/revision/{id}", ["RevisionController", "api_set"]);

Routes::add_api("POST", "/api/search/title", ["SearchController", "api_title_search"]);

Routes::add_api("GET", "/api/spider/pdfs", ["SpiderController", "api_pdfs"], ["Auth", "can_moderate"]);
Routes::add_api("DELETE", "/api/spider/pdf/{id}", ["SpiderController", "api_reject_pdf"], ["Auth", "can_moderate"]);
Routes::add_api("DELETE", "/api/spider/pdf", ["SpiderController", "api_reject_pdf"], ["Auth", "can_moderate"]);
Routes::add_api("PUT", "/api/spider/pdf/{id}", ["SpiderController", "api_accept_pdf"], ["Auth", "can_moderate"]);
Routes::add_api("PUT", "/api/spider/pdf", ["SpiderController", "api_accept_pdf"], ["Auth", "can_moderate"]);

Routes::add_api("GET", "/api/spider/pages", ["SpiderController", "api_pages"], ["Auth", "can_moderate"]);
Routes::add_api("DELETE", "/api/spider/page/{id}", ["SpiderController", "api_reject_page"], ["Auth", "can_moderate"]);
Routes::add_api("PUT", "/api/spider/page/{id}", ["SpiderController", "api_accept_page"], ["Auth", "can_moderate"]);

Routes::add_api("GET", "/api/imports", ["ImportController", "api_imports"], ["Auth", "can_upload"]);
Routes::add_api("DELETE", "/api/import/{id}", ["ImportController", "api_delete_import"], ["Auth", "can_upload"]);
Routes::add_api("POST", "/api/import/{id}", ["ImportController", "api_set_import"], ["Auth", "can_upload"]);
Routes::add_api("PUT", "/api/import/{id}", ["ImportController", "api_add_document"], ["Auth", "can_upload"]);


Routes::add_api("GET", "/api/documentbyid/{id}", ["DocumentController", "get_by_id"]);

Routes::add_api("GET", "/api/sys/idmatch", ["SystemController", "api_get_idmatches"], ["Auth", "can_moderate"]);
Routes::add_api("PUT", "/api/sys/idmatch", ["SystemController", "api_add_idmatch"], ["Auth", "can_moderate"]);
Routes::add_api("POST", "/api/sys/idmatch/{id}", ["SystemController", "api_set_idmatch"], ["Auth", "can_moderate"]);
Routes::add_api("DELETE", "/api/sys/idmatch/{id}", ["SystemController", "api_del_idmatch"], ["Auth", "can_moderate"]);

Routes::add_api("POST", "/api/search/prefix", ["DocumentController", "api_get_title_fragment"]);

Routes::add_api("GET", "/api/product/{id}/available_metadata", ["ProductController", "api_available_metadata"]);
Routes::add_api("PUT", "/api/product/{id}/metadata", ["ProductController", "api_add_metadata"]);




Routes::add_api("GET", "/api/jobs/{source}", ["JobController", "api_get_jobs"], ["Auth", "can_moderate"]);
Routes::add_api("DELETE", "/api/jobs/{id}", ["JobController", "api_delete_job"], ["Auth", "can_moderate"]);

Routes::add_api("GET", "/api/docid/{id}", ["DocumentController", "api_guess_docid"], ["Auth", "can_moderate"]);


Routes::add_api("GET", "/api/product/gemini_all/{id}", ["ProductController", "api_gemini_all"], ["Auth", "can_moderate"]);
