type asset_type =
  | Cash
  | Stock
  | Bond
  | Real_estate
  | Other

let asset_type_to_string (at : asset_type) : string =
  match at with
  | Cash -> "Cash"
  | Stock -> "Stock"
  | Bond -> "Bond"
  | Real_estate -> "Real Estate"
  | Other -> "Other"

type asset = {
  name : string;
  asset_type : asset_type;
  value : real;
}

let create_asset (name : string) (asset_type : asset_type) (value : real) : asset option =
  if value <. 0.0 then
    None
  else
    Some { name = name; asset_type = asset_type; value = value }

let asset_equal (a1 : asset) (a2 : asset) : bool =
  a1.value = a2.value

let asset_to_dict (a : asset) : real =
  a.value

let asset_from_dict (value : real) (name : string) (asset_type : asset_type) : asset option =
  create_asset name asset_type value

let main () : unit =
  let asset_opt = create_asset "Example Asset" Cash 1000.0 in
  match asset_opt with
  | None -> ()
  | Some asset ->
    let asset_dict = asset_to_dict asset in
    let new_asset_opt = asset_from_dict asset_dict "New Asset" Cash in
    ()
