[
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "Opportunity",
    "table": "ophead",
    "isRest": true,
    "idSequenceName": "ophead_ophead_id_seq",
    "lockable": true,
    "orderSequence": "OpportunityNumber",
    "comment": "Opportunity Map",
    "privileges": {
      "all": {
        "create": "MaintainAllOpportunities",
        "read": "ViewAllOpportunities",
        "update": "MaintainAllOpportunities",
        "delete": "MaintainAllOpportunities"
      },
      "personal": {
        "create": "MaintainPersonalOpportunities",
        "read": "ViewPersonalOpportunities",
        "update": "MaintainPersonalOpportunities",
        "delete": "MaintainPersonalOpportunities",
        "properties": [
          "owner.username",
          "assignedTo.username"
        ]
      },
      "attribute": {
        "owner": {
          "create": "EditOwner",
          "update": "EditOwner"
        }
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "ophead_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "number",
        "attr": {
          "type": "String",
          "column": "ophead_number",
          "isNaturalKey":true,
          "required": true
        }
      },
      {
        "name": "name",
        "attr": {
          "type": "String",
          "column": "ophead_name",
          "required": true
        }
      },
      {
        "name": "isActive",
        "attr": {
          "type": "Boolean",
          "column": "ophead_active",
          "required": true
        }
      },
      {
        "name": "account",
        "toOne": {
          "isNested": true,
          "type": "AccountRelation",
          "column": "ophead_crmacct_id",
          "required": true
        }
      },
      {
        "name": "contact",
        "toOne": {
          "isNested": true,
          "type": "ContactRelation",
          "column": "ophead_cntct_id"
        }
      },
      {
        "name": "opportunityStage",
        "toOne": {
          "type": "OpportunityStage",
          "column": "ophead_opstage_id",
          "required": true
        }
      },
      {
        "name": "priority",
        "toOne": {
          "type": "Priority",
          "column": "ophead_priority_id"
        }
      },
      {
        "name": "opportunitySource",
        "toOne": {
          "type": "OpportunitySource",
          "column": "ophead_opsource_id",
          "required": true
        }
      },
      {
        "name": "opportunityType",
        "toOne": {
          "type": "OpportunityType",
          "column": "ophead_optype_id",
          "required": true
        }
      },
      {
        "name": "amount",
        "attr": {
          "type": "Money",
          "column": "ophead_amount"
        }
      },
      {
        "name": "currency",
        "toOne": {
          "type": "Currency",
          "column": "ophead_curr_id"
        }
      },
      {
        "name": "probability",
        "attr": {
          "type": "Percent",
          "column": "ophead_probability_prcnt"
        }
      },
      {
        "name": "startDate",
        "attr": {
          "type": "Date",
          "column": "ophead_start_date"
        }
      },
      {
        "name": "assignDate",
        "attr": {
          "type": "Date",
          "column": "ophead_assigned_date"
        }
      },
      {
        "name": "targetClose",
        "attr": {
          "type": "DueDate",
          "column": "ophead_target_date"
        }
      },
      {
        "name": "actualClose",
        "attr": {
          "type": "Date",
          "column": "ophead_actual_date"
        }
      },
      {
        "name": "notes",
        "attr": {
          "type": "String",
          "column": "ophead_notes"
        }
      },
      {
        "name": "owner",
        "toOne": {
          "isNested": true,
          "type": "UserAccountRelation",
          "column": "ophead_owner_username",
          "inverse": "username"
        }
      },
      {
        "name": "assignedTo",
        "toOne": {
          "isNested": true,
          "type": "UserAccountRelation",
          "column": "ophead_username",
          "inverse": "username"
        }
      },
      {
        "name": "documents",
        "toMany": {
          "type": "DocumentAssociation",
          "column": "ophead_id",
          "inverse": "source",
          "sourceType": "OPP",
          "isNested": true
        }
      },
      {
        "name": "comments",
        "toMany": {
          "isNested": true,
          "type": "OpportunityComment",
          "column": "ophead_id",
          "inverse": "opportunity"
        }
      },
      {
        "name": "characteristics",
        "toMany": {
          "isNested": true,
          "type": "OpportunityCharacteristic",
          "column": "ophead_id",
          "inverse": "opportunity"
        }
      }
    ],
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunityCharacteristic",
    "table": "charass",
    "idSequenceName": "charass_charass_id_seq",
    "comment": "Opportunity Characteristic Map",
    "privileges": {
      "all": {
        "create": true,
        "read": true,
        "update": true,
        "delete": true
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "charass_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "uuid",
        "attr": {
          "type": "String",
          "column": "obj_uuid",
          "isNaturalKey": true
        }
      },
      {
        "name": "targetType",
        "attr": {
          "type": "String",
          "column": "charass_target_type",
          "value": "OPP"
        }
      },
      {
        "name": "opportunity",
        "attr": {
          "type": "Number",
          "column": "charass_target_id"
        }
      },
      {
        "name": "characteristic",
        "toOne": {
          "type": "Characteristic",
          "column": "charass_char_id",
          "required": true
        }
      },
      {
        "name": "value",
        "attr": {
          "type": "String",
          "column": "charass_value"
        }
      }
    ],
    "isNestedOnly": true,
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunityListItemCharacteristic",
    "table": "charass",
    "comment": "Opportunity List Item Characteristic Map",
    "privileges": {
      "all": {
        "create": true,
        "read": true,
        "update": true,
        "delete": true
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "charass_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "uuid",
        "attr": {
          "type": "String",
          "column": "obj_uuid",
          "isNaturalKey": true
        }
      },
      {
        "name": "targetType",
        "attr": {
          "type": "String",
          "column": "charass_target_type",
          "value": "OPP"
        }
      },
      {
        "name": "opportunity",
        "attr": {
          "type": "Number",
          "column": "charass_target_id"
        }
      },
      {
        "name": "characteristic",
        "toOne": {
          "type": "Characteristic",
          "column": "charass_char_id",
          "required": true
        }
      },
      {
        "name": "value",
        "attr": {
          "type": "String",
          "column": "charass_value"
        }
      }
    ],
    "isNestedOnly": true,
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunityComment",
    "table": "comment",
    "idSequenceName": "comment_comment_id_seq",
    "comment": "Opportunity Comment Map",
    "privileges": {
      "all": {
        "create": true,
        "read": true,
        "update": "EditOthersComments",
        "delete": false
      },
      "personal": {
        "update": "EditOwnComments",
        "properties": [
          "createdBy"
        ]
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "comment_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "uuid",
        "attr": {
          "type": "String",
          "column": "obj_uuid",
          "isNaturalKey": true
        }
      },
      {
        "name": "sourceType",
        "attr": {
          "type": "String",
          "column": "comment_source",
          "value": "OPP"
        }
      },
      {
        "name": "opportunity",
        "attr": {
          "type": "Number",
          "column": "comment_source_id"
        }
      },
      {
        "name": "commentType",
        "toOne": {
          "type": "CommentType",
          "column": "comment_cmnttype_id",
          "required": true
        }
      },
      {
        "name": "text",
        "attr": {
          "type": "String",
          "column": "comment_text"
        }
      },
      {
        "name": "isPublic",
        "attr": {
          "type": "Boolean",
          "column": "comment_public",
          "value": true
        }
      },
      {
        "name": "created",
        "attr": {
          "type": "Date",
          "column": "comment_date"
        }
      },
      {
        "name": "createdBy",
        "attr": {
          "type": "String",
          "column": "comment_user"
        }
      }
    ],
    "isNestedOnly": true,
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunityRelation",
    "table": "xt.opheadinfo",
    "isRest": true,
    "comment": "Opporunity Relation Map",
    "privileges": {
      "all": {
        "create": false,
        "read": "ViewAllOpportunities MaintainAllOpportunities",
        "update": false,
        "delete": false
      },
      "personal": {
        "create": false,
        "read": true,
        "update": false,
        "delete": false,
        "properties": [
          "owner.username",
          "assignedTo.username"
        ]
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "ophead_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "number",
        "attr": {
          "type": "String",
          "column": "ophead_number",
          "isNaturalKey":true
        }
      },
      {
        "name": "name",
        "attr": {
          "type": "String",
          "column": "ophead_name"
        }
      },
      {
        "name": "isActive",
        "attr": {
          "type": "Boolean",
          "column": "ophead_active"
        }
      },
      {
        "name": "opportunityStage",
        "toOne": {
          "type": "OpportunityStage",
          "column": "ophead_opstage_id"
        }
      },
      {
        "name": "targetClose",
        "attr": {
          "type": "DueDate",
          "column": "ophead_target_date"
        }
      },
      {
        "name": "owner",
        "toOne": {
          "isNested": true,
          "type": "UserAccountRelation",
          "column": "ophead_owner_username",
          "inverse": "username"
        }
      },
      {
        "name": "assignedTo",
        "toOne": {
          "isNested": true,
          "type": "UserAccountRelation",
          "column": "ophead_username",
          "inverse": "username"
        }
      },
      {
        "name": "account",
        "attr": {
          "type": "String",
          "column": "crmacct_number"
        }
      },
      {
        "name": "contact",
        "attr": {
          "type": "String",
          "column": "cntct_number"
        }
      }
    ],
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunityListItem",
    "table": "xt.opheadinfo",
    "isRest": true,
    "comment": "Opporunity List Item Map",
    "privileges": {
      "all": {
        "create": false,
        "read": "ViewAllOpportunities MaintainAllOpportunities",
        "update": false,
        "delete": false
      },
      "personal": {
        "create": false,
        "read": true,
        "update": false,
        "delete": false,
        "properties": [
          "owner.username",
          "assignedTo.username"
        ]
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "ophead_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "number",
        "attr": {
          "type": "String",
          "column": "ophead_number",
          "isNaturalKey":true
        }
      },
      {
        "name": "name",
        "attr": {
          "type": "String",
          "column": "ophead_name"
        }
      },
      {
        "name": "isActive",
        "attr": {
          "type": "Boolean",
          "column": "ophead_active"
        }
      },
      {
        "name": "account",
        "toOne": {
          "isNested": true,
          "type": "AccountRelation",
          "column": "ophead_crmacct_id"
        }
      },
      {
        "name": "contact",
        "toOne": {
          "isNested": true,
          "type": "ContactRelation",
          "column": "ophead_cntct_id"
        }
      },
      {
        "name": "targetClose",
        "attr": {
          "type": "DueDate",
          "column": "ophead_target_date"
        }
      },
      {
        "name": "startDate",
        "attr": {
          "type": "Date",
          "column": "ophead_start_date"
        }
      },
      {
        "name": "actualDate",
        "attr": {
          "type": "Date",
          "column": "ophead_actual_date"
        }
      },
      {
        "name": "assignDate",
        "attr": {
          "type": "Date",
          "column": "ophead_assigned_date"
        }
      },
      {
        "name": "opportunityStage",
        "toOne": {
          "type": "OpportunityStage",
          "column": "ophead_opstage_id"
        }
      },
      {
        "name": "opportunityType",
        "toOne": {
          "type": "OpportunityType",
          "column": "ophead_optype_id"
        }
      },
      {
        "name": "opportunitySource",
        "toOne": {
          "type": "OpportunitySource",
          "column": "ophead_opsource_id"
        }
      },
      {
        "name": "priority",
        "toOne": {
          "type": "Priority",
          "column": "ophead_priority_id"
        }
      },
      {
        "name": "owner",
        "toOne": {
          "isNested": true,
          "type": "UserAccountRelation",
          "column": "ophead_owner_username",
          "inverse": "username"
        }
      },
      {
        "name": "assignedTo",
        "toOne": {
          "isNested": true,
          "type": "UserAccountRelation",
          "column": "ophead_username",
          "inverse": "username"
        }
      },
      {
        "name": "amount",
        "attr": {
          "type": "Money",
          "column": "ophead_amount"
        }
      },
      {
        "name": "currency",
        "toOne": {
          "type": "Currency",
          "column": "ophead_curr_id"
        }
      },
      {
        "name": "priorityOrder",
        "attr": {
          "type": "Number",
          "column": "priority_order"
        }
      },
      {
        "name": "characteristics",
        "toMany": {
          "isNested": true,
          "type": "OpportunityListItemCharacteristic",
          "column": "ophead_id",
          "inverse": "opportunity"
        }
      }
    ],
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunitySource",
    "table": "opsource",
    "isRest": true,
    "idSequenceName": "opsource_opsource_id_seq",
    "lockable": true,
    "comment": "Opportunity Source Map",
    "privileges": {
      "all": {
        "create": "MaintainOpportunitySources",
        "read": true,
        "update": "MaintainOpportunitySources",
        "delete": "MaintainOpportunitySources"
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "opsource_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "name",
        "attr": {
          "type": "String",
          "column": "opsource_name",
          "isNaturalKey":true
        }
      },
      {
        "name": "description",
        "attr": {
          "type": "String",
          "column": "opsource_descrip"
        }
      }
    ],
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunityStage",
    "table": "opstage",
    "isRest": true,
    "idSequenceName": "opstage_opstage_id_seq",
    "lockable": true,
    "comment": "Opportunity Stage Map",
    "privileges": {
      "all": {
        "create": "MaintainOpportunityStages",
        "read": true,
        "update": "MaintainOpportunityStages",
        "delete": "MaintainOpportunityStages"
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "opstage_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "name",
        "attr": {
          "type": "String",
          "column": "opstage_name",
          "isNaturalKey":true
        }
      },
      {
        "name": "description",
        "attr": {
          "type": "String",
          "column": "opstage_descrip"
        }
      },
      {
        "name": "deactivate",
        "attr": {
          "type": "Boolean",
          "column": "opstage_opinactive",
          "required": true
        }
      }
    ],
    "isSystem": true
  },
  {
    "context": "xtuple",
    "nameSpace": "XM",
    "type": "OpportunityType",
    "table": "optype",
    "isRest": true,
    "idSequenceName": "optype_optype_id_seq",
    "lockable": true,
    "comment": "Opportunity Type Map",
    "privileges": {
      "all": {
        "create": "MaintainOpportunityTypes",
        "read": true,
        "update": "MaintainOpportunityTypes",
        "delete": "MaintainOpportunityTypes"
      }
    },
    "properties": [
      {
        "name": "id",
        "attr": {
          "type": "Number",
          "column": "optype_id",
          "isPrimaryKey": true
        }
      },
      {
        "name": "name",
        "attr": {
          "type": "String",
          "column": "optype_name",
          "isNaturalKey":true
        }
      },
      {
        "name": "description",
        "attr": {
          "type": "String",
          "column": "optype_descrip"
        }
      }
    ],
    "isSystem": true
  }
]
