 
 (defn- email-variations [emails]
   (remove nil? (mapcat #(list %
-                 (string/upper-case %)
-                 (string/lower-case %)
-                 (string/capitalize %)
-                 (capitalize-name %)) emails)))
+                              (string/upper-case %)
+                              (string/lower-case %)
+                              (string/capitalize %)
+                              (capitalize-name %)) emails)))
 
 ;;;
 

     (clj-http/with-connection-pool {:timeout 10 :threads 4 :insecure? false :default-per-route 10}
       (-> initial
           (assoc :id nil
                  :user_id (:id user)
                  :email   (recipient (:emails user) assertion)
                  :status "pending"
                  :visibility "private"
                  :show_recipient_name 0
                  :rating nil
                  :ctime now
                  :mtime now
                  :deleted 0
                  :revoked 0
                  :issuer_verified 0
                  :show_evidence 0
                  :last_checked nil
                  :old_id nil)
           (badge-content assertion)
           valid-badge)))))


                   ;; list of evidences
                   (coll? (:evidence assertion)) (mapv (fn [e]
                                                         {:id nil
                                                          :user_badge_id nil
                                                          :url (:id e)
                                                          :narrative (:narrative e)
                                                          :name (:name e)
                                                          :description (:description e)
                                                          :genre (:genre e)
                                                          :audience (:audience e)
                                                          :ctime now
                                                          :mtime now}) (:evidence assertion))
                   :else [])

        badge  (if (map? (:badge assertion)) (:badge assertion) (http/json-get (:badge assertion)))
        related (->> (get badge :related [])
                     (map #(http/json-get (:id %)))
                     (remove #(nil? ((keyword "@language") %))))
        default-language (get badge (keyword "@language") "")
        endorsement (cond
                      (map? (:endorsement assertion)) [{:id nil
                                                        :external_id (get-in assertion [:endorsement :id])
                                                        :user_badge_id nil
                                                        :issuer_id nil
                                                        :issuer_name (get-in assertion [:endorsement :issuer :name])
                                                        :issuer_url (get-in assertion [:endorsement :issuer :id])
                                                        :content (get-in assertion [:endorsement :claim :endorsementComment])
                                                        :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
                                                        :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
                                                        }]

                      (coll? (:endorsement assertion)) (mapv (fn [e]
                                                              {:id nil
                                                               :external_id (get-in assertion [:endorsement :id])
                                                               :user_badge_id nil
                                                               :issuer_id nil
                                                               :issuer_name (get-in assertion [:endorsement :issuer :name])
                                                               :issuer_url (get-in assertion [:endorsement :issuer :id])
                                                               :content (get-in assertion [:endorsement :claim :endorsementComment])
                                                               :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
                                                               :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
                                                               }) (:endorsement assertion))
                      :else []
                      ) ]

    (assoc initial
      :badge (merge {:id ""
                     :remote_url nil
                     :remote_id nil
                     :remote_issuer_id nil
                     :issuer_verified 0
                     :default_language_code default-language
                     :published 0
                     :last_received 0
                     :recipient_count 0
                     }
                    (apply merge-with (cons concat (map parser (cons badge related)))))
      :issued_on  (u/str->epoch (:issuedOn assertion))
      :expires_on (u/str->epoch (:expires assertion))
      :evidence evidence
      :endorsement endorsement
      )))
;;;

(defmethod badge-content :default [initial assertion]
