package com.conveyal.analysis.models;

import com.conveyal.analysis.UserPermissions;
import org.bson.types.ObjectId;

public class BaseModel {
    // Can retrieve `createdAt` from here
    public ObjectId _id = new ObjectId();

    // For version management. ObjectId's contain a timestamp, so can retrieve `updatedAt` from here.
    public ObjectId nonce = new ObjectId();

    public String createdBy = null;
    public String updatedBy = null;

    // Who owns this?
    public String accessGroup = null;

    // Everything has a name
    public String name = null;

    // package private to encourage use of static factory methods
    BaseModel (UserPermissions user, String name) {
        this.createdBy = user.email;
        this.updatedBy = user.email;
        this.accessGroup = user.accessGroup;
        this.name = name;
    }


    BaseModel () {
        // No-arg
    }

}

@@ -181,32 +181,38 @@
 here%0A    public 
+final 
 ObjectId _id = n
@@ -839,20 +839,106 @@
 %0A    %7D%0A%0A
-%0A
    
+ /**%0A     * No-arg constructor required for Mongo POJO serialization%0A     */%0A    public
  BaseMod
@@ -957,23 +957,13 @@
     
-// No-arg
 %0A    %7D%0A
-%0A
 %7D%0A

make id of BaseModel final