 
 factory = new Factory()
 
+class SObject
+  constructor: ->
+    @fields = {}
+    @actionOverrides = {}
+  set: (field, value, tag) ->
+    switch field
+    # named children
+      when 'fields'
+        field = factory.build tag
+        @fields[field.fullName] = field
+      when 'actionOverrides'
+        action = factory.build tag
+        @actionOverrides[action.actionName] = action
+
+    # smart members
+      when 'sharingModel'
+        @sharingModel = new SharingModel value
+      when 'deploymentStatus'
+        @deploymentStatus = new DeploymentStatus value
+      when 'listViews', 'nameField', 'searchLayouts'
+        # TODO: something
+        ''
+
+    # regular members
+      when 'label'
+        @label = value
+      when 'pluralLabel'
+        @pluralLabel = value
+      when 'enableActivities'
+        @enableActivities = value is 'true'
+      when 'enableFeeds'
+        @enableFeeds = value is 'true'
+      when 'enableHistory'
+        @enableHistory = value is 'true'
+      when 'enableReports'
+        @enableReports = value is 'true'
+      else throw new Error "unknown field #{field} on custom object object"
+
 class Field
-  constructor: ->
   set: (field, value, tag) ->
     switch field
     # required

class Factory
  build: (tag) ->
    switch tag.tag
      when 'fields'
        Builder = Field
      when 'picklistValues'
        Builder = PicklistValue
      else throw new Error 'unknown tag type'
    thing = new Builder()
    tag.getchildren().forEach (child) ->
      thing.set child.tag, child.text, child

        @picklist = new Picklist tag
      when 'visibleLines'
        @visibleLines = parseInt value, 10
      else throw new Error "unknown field #{field} on field object"

class DeploymentStatus
  constructor: (@status) ->

class SharingModel
  constructor: (@model) ->

class Type
  constructor: (@value) ->
