# URT

module Couchdb::CouchdbMeta::FieldsScan

  @@fields = {
    # generic: _id, form_, tag_id, tag_value
    "_id": {
      label: "ID"
    },
    "form_": {
      label: "Inspection Type",
      type: "form_",
      attributes: {
	required: true
      }
    },
    "tag_id": {
      label: "Item ID"
    },
    "tag_value": {
      label: "Scan Code",
    },

    # generic: GPS position
    "latitude": {
      label: "Latitude",
    },
    "longitude": {
      label: "Longitude",
    },
    "altitude": {
      label: "Altitude",
    },
    "accuracy": {
      label: "Accuracy",
    },

    # generic: created/updated at
    "created_at": {
      label: "Created"
    },
    "updated_at": {
      label: "Updated"
    },

    # generic: created/updated by
    "created_by": {
      label: "Inspector"
    },
    "updated_by": {
      label: "Updated by"
    },

    # shared fields:
    "reference_number": {
      label: "Reference Number"
    },

    "reinspection": {
      label: "Reinspection",
      type: "checkbox"
    },
    "status": {
      label: "Status",
      type: "select",
      options: {
	"open":   "Open",
	"closed": "Closed"
      },
      attributes: {
	required: true
      }
    },
    "comments": {
      label: "Comments",
      type: "textarea",
      attributes: {
	"rows": 4
      }
    },
    "recommendations": {
      label: "Recommendations",
      type: "textarea",
      attributes: {
	"rows": 4
      }
    },

    # specific: urt-surveillance and urt-destructive
    "firestop_system_type": {
      label: "Firestop System Type",
      type: "select",
      options: {
	"curtain_wall":  "Curtain wall",
	"joints":        "Joints",
	"penetration":   "Penetration"
      },
      attributes: {
	required: true
      }
    },
    "barrier": {
      label: "Barrier",
      type: "select",
      options: {
	"floor": "Floor",
	"wall":  "Wall"
      },
      attributes: {
	required: true
      }
    },
    "barrier_material": {
      label: "Barrier Material",
      type: "select",
      options: {
	"concrete":      "Concrete",
	"gypsum":        "Gypsum",
	"hollow_blocks": "Hollow blocks",
	"reinforced":    "Reinforced"
      },
      attributes: {
	required: true
      }
    },
    "system_type": {
      label: "System Type",
      type: "select",
      options: {
	 "busway_electrical": "Busway/Electrical",
	 "cable_tray":        "Cable tray",
	 "cables":            "Cables",
	 "ducts_mechanical":  "Ducts/Mechanical",
	 "floor_to_floor":    "Floor to floor",
	 "floor_to_wall":     "Floor to wall",
	 "head_of_wall":      "Head of wall",
	 "insulation_type":   "Insulation type",
	 "metallic_pipe":     "Metallic Pipe",
	 "mixed_multiple":    "Mixed/Multiple",
	 "non_metallic_pipe": "Non-metallic pipe",
	 "slab_edge":         "Slab edge",
	 "wall_to_wall":      "Wall to wall"
      },
      attributes: {
	required: true
      }
    },
    "label": {
      label: "Label installed",
      type: "checkbox"
    },
    "non_compliance_reason": {
      label: "Non-compliance",
      type: "select",
      options: {
	"angle_of_inclination":             "Angle of inclination",
	"annular_space":                    "Annular Space",
        "beading_thickness":                "Beading thickness",
	"collar":                           "Collar",
	"distance_between_penetration":     "Distance between penetration",
	"identification_tag":               "Identification/Tag",
	"impacting_joints_system":          "Impacting joints system",
	"insulation":                       "Insulation",
	"joint_gap":                        "Joint gap",
	"mineral_rockwool_compression":     "Mineral/Rockwool Compression",
	"multiple_product_interfacing":     "Multiple product interfacing",
	"no_access":                        "No access",
	"opening_size":                     "Opening size",
	"overlapping":                      "Overlapping",
	"penetrating_item_size":            "Penetrating item size",
	"rockwool_installation":            "Rockwool installation",
	"sealant_thickness":                "Sealant Thickness",
	"site_condition":                   "Site condition (does not meet system requirements)",
	"sleeve_extensions":                "Sleeve extensions",
	"sleeve_installation":              "Sleeve installation",
	"substrate_damage":                 "Substrate damage",
	"system_not_fully_installed":       "System not fully installed",
	"tag_information_does_not_match":   "Tag information does not match submitted/presented documents",
	"unknown_material_found":           "Unknown material found",
	"wrong_assembly":                   "Wrong assembly",
	"other":                            "Other"
      },
      attributes: {
	"multiple": true
      }
    },
    "system_number": {
      label: "System Number",
      attributes: {
	required: true
      }
    },
    "risk_level": {
      label: "Risk Level",
      type: "select",
      options: {
	"low":    "Low",
	"medium": "Medium",
	"high":   "High"
      },
      attributes: {
	required: true
      }
    },

    # specific: urt-firerateddoor
    "functional_test": {
      label: "Functional test",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "visual_inspection": {
      label: "Visual inspection",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "glazing": {
      label: "Glazing",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
        "na":   "N/A"
      },
      attributes: {
        required: true
      }
    },

    "door_frames_and_assembly": {
      label: "Door frames & assembly",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "nothing_missing_broken": {
      label: "Nothing missing/broken",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "door_clearances": {
      label: "Door clearances",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "self_closing_operational": {
      label: "Self-closing operational",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "coordinator": {
      label: "Coordinator",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
        "na":   "N/A"
      },
      attributes: {
        required: true
      }
    },

    "latching_hardware": {
      label: "Latching hardware",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "auxiliary_hardware": {
      label: "Auxiliary hardware",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "no_field_modifications": {
      label: "No field modifications",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "gaskets_and_edge_seals": {
      label: "Gaskets & edge seals",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    },

    "door_label": {
      label: "Label",
      type: "select",
      options: {
        "pass": "Pass",
        "fail": "Fail",
      },
      attributes: {
        required: true
      }
    }
  }

  def self.getFields
    return @@fields
  end
end
