-- name: InsertFileMsofficeOleid :exec
INSERT INTO msoffice_oleid (
  file_id, data
) VALUES ($1, $2);

-- name: InsertFileMsofficeOlevba :exec
INSERT INTO msoffice_olevba (
  file_id, data
) VALUES ($1, $2);

-- name: InsertFileMsofficeMraptor :exec
INSERT INTO msoffice_mraptor (
  file_id, data
) VALUES ($1, $2);

-- name: GetMSOfficeData :one
SELECT t1.file_id, t1.data AS oleid, t2.data AS olevba, t3.data AS mraptor
 FROM msoffice_oleid as t1
 LEFT join msoffice_olevba AS t2 ON t2.file_id = t1.file_id
 LEFT JOIN msoffice_mraptor AS t3 ON t3.file_id = t1.file_id
 WHERE t1.file_id = $1;

-- name: InsertMSOfficeResults :exec
INSERT INTO msoffice (
  file_id, verdict, container_format, encrypted, file_format, vba_macros, xlm_macros,
  vba_stomping, nb_autoexec, nb_iocs, nb_macros, nb_suspicious, olevba_results, macros
) VALUES (
  $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14
);

-- name: GetMSOfficeResults :one
SELECT * FROM msoffice
WHERE file_id = $1
LIMIT 1;
