@import { IdConstructorModel } from "../types";
@define idMethods(type: IdConstructorModel)

// methods for @type.name
export function @(type.constructorName)(@type.fieldName: @type.fieldType): @type.name {
  return @type.fieldName == null ? null : { @type.fieldName };
}

export function is@(type.name)(obj: any): obj is @type.name {
  return obj !== null && typeof obj === "object" && "@type.fieldName" in obj;
}

export function @(type.constructorName)Equals(id1: @type.name, id2: @type.name): boolean {
  return (id1 && id1.@type.fieldName) === (id2 && id2.@type.fieldName);
}
