Pātuhitia tēnei: A legal theory for autonomous artificial agents