{
  "@context":[
    "https://www.w3.org/ns/activitystreams",
    "https://w3id.org/security/v1",
    {
      "schema":"http://schema.org#",
      "PropertyValue":"schema:PropertyValue",
      "value":"schema:value"
    }
  ],
  <%- if (username = actor.username) -%>
  "preferredUsername":<%= username.to_json %>,
  <%- end -%>
  <%- if (pem_public_key = actor.pem_public_key) -%>
  "publicKey":{
    "id":"<%= actor.iri %>#main-key",
    "owner":"<%= actor.iri %>",
    "publicKeyPem":<%= pem_public_key.to_json %>
  },
  <%- end -%>
  <%- if (inbox = actor.inbox) -%>
  <%# some services (e.g. PeerTube) expect a "shared" inbox %>
  <%# proffer the actor's inbox %>
  <%- if actor.local? -%>
  "endpoints": {
    "sharedInbox": <%= inbox.to_json %>
  },
  <%- end -%>
  "inbox":<%= inbox.to_json %>,
  <%- end -%>
  <%- if (outbox = actor.outbox) -%>
  "outbox":<%= outbox.to_json %>,
  <%- end -%>
  <%- if (following = actor.following) -%>
  "following":<%= following.to_json %>,
  <%- end -%>
  <%- if (followers = actor.followers) -%>
  "followers":<%= followers.to_json %>,
  <%- end -%>
  <%- if (name = actor.name) -%>
  "name":<%= name.to_json %>,
  <%- end -%>
  <%- if (summary = actor.summary) -%>
  "summary":<%= summary.to_json %>,
  <%- end -%>
  <%- if (icon = actor.icon) -%>
  "icon":{
    "type":"Image",
    "url":<%= icon.to_json %>
  },
  <%- end -%>
  <%- if (image = actor.image) -%>
  "image":{
    "type":"Image",
    "url":<%= image.to_json %>
  },
  <%- end -%>
  <%- if (attachments = actor.attachments) -%>
  "attachment":[
    <%- attachments.each.with_index do |attachment, i| %> {
    "type":<%= attachment.type.to_json %>,
    "name":<%= attachment.name.to_json %>,
    "value":<%= wrap_link(attachment.value).to_json %>
    }<%= comma(attachments, i) %><%- end -%>
  ],
  <%- end -%>
  <%- if (urls = actor.urls) -%>
  <%- if urls.size > 1 -%>
  "url":<%= urls.to_json %>,
  <%- elsif urls.size > 0 -%>
  "url":<%= urls.first.to_json %>,
  <%- end -%>
  <%- end -%>
  "type":<%= actor.type.split("::").last.to_json %>,
  "id":<%= actor.iri.to_json %>
}
