// Path: src/main/java/com/codefork/refine/NameType.java
// public enum NameType {
//     Person("/people/person", "Person", "Personal", "local.personalNames all \"%s\""),
//     Organization("/organization/organization", "Corporate Name", "Corporate", "local.corporateNames all \"%s\""),
//     Location("/location/location", "Geographic Name", "Geographic", "local.geographicNames all \"%s\""),
//     // can't find better freebase ids for these two
//     Book("/book/book", "Work", "UniformTitleWork", "local.uniformTitleWorks all \"%s\""),
//     Edition("/book/book edition", "Expression", "UniformTitleExpression", "local.uniformTitleExpressions all \"%s\"");
// 
//     // ids are from freebase identifier ns
//     private final String id;
//     private final String displayName;
//     private final String viafCode;
//     private final String cqlString;
// 
//     NameType(String id, String displayName, String viafCode, String cqlString) {
//        this.id = id;
//        this.displayName = displayName;
//        this.viafCode = viafCode;
//        this.cqlString = cqlString;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getDisplayName() {
//         return displayName;
//     }
// 
//     public String getViafCode() {
//         return viafCode;
//     }
// 
//     public String getCqlString() {
//         return cqlString;
//     }
// 
//     public VIAFNameType asVIAFNameType() {
//         return new VIAFNameType(getId(), getDisplayName());
//     }
// 
//     public static NameType getByViafCode(String viafCodeArg) {
//         for(NameType nameType: NameType.values()) {
//             if(nameType.viafCode.equals(viafCodeArg)) {
//                 return nameType;
//             }
//         }
//         return null;
//     }
// 
//     public static NameType getById(String idArg) {
//         for(NameType nameType: NameType.values()) {
//             if(nameType.id.equals(idArg)) {
//                 return nameType;
//             }
//         }
//         return null;
//     }
// 
// }


import com.codefork.refine.NameType;
import java.util.ArrayList;
import java.util.List;

package com.codefork.refine.resources;



/**
 * A single name result. The JSON looks like this:
 * 
 * {
 *     'id' : '...',
 *     'name': '...',
 *     'type': [
 *         {
 *             "id": '...',
 *             "name": '...',
 *         },
 *     ],
 *     'score': 1,
 *     'match': true
 * }
 */
public class Result {
    
    private String id;
    private String name;

    /**
     * It's weird that this is a list but that's what OpenRefine expects.
     * A VIAF result only ever has one type, but maybe other reconciliation
     * services return multiple types for a name?
     */
    private List<VIAFNameType> type;
    private double score;
    private boolean match;

// Path: src/main/java/com/codefork/refine/NameType.java
// public enum NameType {
//     Person("/people/person", "Person", "Personal", "local.personalNames all \"%s\""),
//     Organization("/organization/organization", "Corporate Name", "Corporate", "local.corporateNames all \"%s\""),
//     Location("/location/location", "Geographic Name", "Geographic", "local.geographicNames all \"%s\""),
//     // can't find better freebase ids for these two
//     Book("/book/book", "Work", "UniformTitleWork", "local.uniformTitleWorks all \"%s\""),
//     Edition("/book/book edition", "Expression", "UniformTitleExpression", "local.uniformTitleExpressions all \"%s\"");
// 
//     // ids are from freebase identifier ns
//     private final String id;
//     private final String displayName;
//     private final String viafCode;
//     private final String cqlString;
// 
//     NameType(String id, String displayName, String viafCode, String cqlString) {
//        this.id = id;
//        this.displayName = displayName;
//        this.viafCode = viafCode;
//        this.cqlString = cqlString;
//     }
// 
//     public String getId() {
//         return id;
//     }
// 
//     public String getDisplayName() {
//         return displayName;
//     }
// 
//     public String getViafCode() {
//         return viafCode;
//     }
// 
//     public String getCqlString() {
//         return cqlString;
//     }
// 
//     public VIAFNameType asVIAFNameType() {
//         return new VIAFNameType(getId(), getDisplayName());
//     }
// 
//     public static NameType getByViafCode(String viafCodeArg) {
//         for(NameType nameType: NameType.values()) {
//             if(nameType.viafCode.equals(viafCodeArg)) {
//                 return nameType;
//             }
//         }
//         return null;
//     }
// 
//     public static NameType getById(String idArg) {
//         for(NameType nameType: NameType.values()) {
//             if(nameType.id.equals(idArg)) {
//                 return nameType;
//             }
//         }
//         return null;
//     }
// 
// }


// Path: src/main/java/com/codefork/refine/resources/Result.java
import com.codefork.refine.NameType;
import java.util.ArrayList;
import java.util.List;


package com.codefork.refine.resources;



/**
 * A single name result. The JSON looks like this:
 * 
 * {
 *     'id' : '...',
 *     'name': '...',
 *     'type': [
 *         {
 *             "id": '...',
 *             "name": '...',
 *         },
 *     ],
 *     'score': 1,
 *     'match': true
 * }
 */
public class Result {
    
    private String id;
    private String name;

    /**
     * It's weird that this is a list but that's what OpenRefine expects.
     * A VIAF result only ever has one type, but maybe other reconciliation
     * services return multiple types for a name?
     */
    private List<VIAFNameType> type;
    private double score;
    private boolean match;

    public Result(String id, String name, NameType nameType, double score, boolean match) {