-- vim: ft=terra
local m = {
	agentkind = lib.enum {
		'user', 'circle'
	};
}

struct m.agent {
	kind: m.agentkind.t
	id: uint64
}

terra m.eval(expr: lib.str.t, agent: m.agent)

end


terra lib.store.post:comp()
 -- TODO extract mentions from body, circles from acl
	self.mentions = [lib.mem.ptr(uint64)].null()
	self.circles = [lib.mem.ptr(uint64)].null()
	self.convoheaduri = nil
end

terra lib.store.post:save(ctupdate: bool)
 -- this post handles the messy details of registering a post's
 -- circles and actors, and increments the edit-count if ctupdate
 -- is true, which is should be in almost all cases.
	if ctupdate then
		self.chgcount = self.chgcount + 1
		self.edited = lib.osclock.time(nil)
	end
	self:comp()
	self.source:post_save(self)
end

return m
