/******************************************************************************
 * Copyright (c) 2000-2025 Ericsson Telecom AB
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
 *
 * Contributors:
 *   Balasko, Jeno
 *   Baranyi, Botond
 *
 ******************************************************************************/

module one {
type record Rec {
  integer num,
  universal charstring str
} with {
  variant(num) "JSON : default(0)";
  variant(str) "JSON : default(empty)";
  variant "JSON : extend (comment) : (abc)";
}

type set Set {
  octetstring os,
  boolean buul optional,
  verdicttype verd optional,
  float numbr
} with {
  variant(numbr) " JSON : default (-infinity) ";
  variant(buul) " JSON:omit as null ";
  variant(os)  "extend(MSB):(first) ";
}

type union Uni {
  float numbr,
  octetstring bytes
} with {
  variant "JSON: extend (defaultSelection) : (numbr)";
}

type record HasAny {
  integer num,
  anytype at
}

type enumerated Height { Short, Medium, Tall };

type enumerated Width { Thin, Medium, Wide };

external function f_enc_rec(in Rec x) return octetstring
  with { extension "prototype(convert) encode(JSON)" }

external function f_dec_rec(in octetstring octie) return Rec
  with { extension "prototype(convert) decode(JSON) errorbehavior(ALL:WARNING,INVAL_MSG:ERROR)" }

} with {
  encode "JSON";
  extension "anytype integer,boolean,bitstring";
}
