(**************************************************************************)
(*                                BELENIOS                                *)
(*                                                                        *)
(*  Copyright © 2012-2022 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/>.                                       *)
(**************************************************************************)

type uuid = string wrap <ocaml module="Belenios_core.Common_types.Uuid">
type 'a proof <ocaml predef from="Belenios_core.Serializable_core"> = abstract
type question = abstract wrap <ocaml module="Question">
type lang_dir <ocaml predef from="Belenios_core.Serializable"> = abstract

type 'a params = {
  version : int;
  description : string;
  name : string;
  group : string;
  public_key : 'a;
  questions : question list <ocaml repr="array">;
  uuid : uuid;
  ?administrator : string option;
  ?credential_authority : string option;
  ?language : (string * lang_dir) option;
} <ocaml field_prefix="e_">
<doc text="Election parameters relevant for creating a ballot.">

type 'a signature = {
  hash : string;
  proof : 'a proof;
} <ocaml field_prefix="s_">

type ('a, 'b) ballot = {
  election_uuid : uuid;
  election_hash : string;
  credential : 'a;
  answers : abstract list <ocaml repr="array">;
  ?signature : 'b signature option;
}
