(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
(*  Copyright © 2012-2023 Inria                                           *)
(*                                                                        *)
(*  This program is free software: you can redistribute it and/or modify  *)
(*  it under the terms of the GNU Affero General Public License as        *)
(*  published by the Free Software Foundation, either version 3 of the    *)
(*  License, or (at your option) any later version, with the additional   *)
(*  exemption that compiling, linking, and/or using OpenSSL is allowed.   *)
(*                                                                        *)
(*  This program is distributed in the hope that it will be useful, but   *)
(*  WITHOUT ANY WARRANTY; without even the implied warranty of            *)
(*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *)
(*  Affero General Public License for more details.                       *)
(*                                                                        *)
(*  You should have received a copy of the GNU Affero General Public      *)
(*  License along with this program.  If not, see                         *)
(*  <http://www.gnu.org/licenses/>.                                       *)
(**************************************************************************)

<doc text="Serializable datatypes for lists questions">

(** {2 Predefined types} *)

type weight = abstract wrap <ocaml module="Belenios_core.Common_types.Weight">
type 'a ciphertext <ocaml predef from="Belenios_core.Serializable_core"> = abstract
type 'a proof <ocaml predef from="Belenios_core.Serializable_core"> = abstract
type 'a disjunctive_proof <ocaml predef from="Belenios_core.Serializable_core"> = abstract

(** {2 Non-zero proof} *)

type ('a, 'b) nonzero_proof = {
  commitment : 'a;
  challenge : 'b;
  response : ('b * 'b);
} <ocaml field_prefix="n">

(** {2 Questions and answers} *)

type question = {
  answers : string list <ocaml repr="array"> list <ocaml repr="array">;
  question : string;
} <ocaml field_prefix="q_">

type ('a, 'b) answer = {
  choices : 'a ciphertext list <ocaml repr="array"> list <ocaml repr="array">;
  individual_proofs : 'b disjunctive_proof list <ocaml repr="array"> list <ocaml repr="array">;
  overall_proof : 'b proof;
  list_proofs : 'b disjunctive_proof list <ocaml repr="array">;
  nonzero_proof : ('a, 'b) nonzero_proof;
}

type result = weight list <ocaml repr="array"> list <ocaml repr="array">
