(function() {
  'use strict';
  window.ElsDash = window.ElsDash || {};

  // ============================================================
  // COLUMN MAPPING - Change these if DB column names change
  // ============================================================
  var COLS = {
    ROW_ID:         'charge_id',
    NAME:           'name',
    FILE_NUMBER:    'return_id_num',
    CALLSIGN:       'callsign',
    RECEIPT_DATE:   'receipt_date',
    STATUS_DATE:    'status_date',
    STATUS_DESC:    'status_description',
    OPEN_DATE:      'date_opened',
    CLOSE_DATE:     'date_closed',
    CHARGE:         'charge_description',
    FREQ_LO:        'lower_frequency',
    FREQ_HI:        'upper_frequency',
    EXPERIMENT_TYPE:'experiment_type_description',
    FIXED_LAT_DEG:  'fixed_latitude_degrees',
    FIXED_LAT_MIN:  'fixed_latitude_minutes',
    FIXED_LAT_SEC:  'fixed_latitude_seconds',
    FIXED_LAT_DIR:  'fixed_latitude_dir',
    FIXED_LON_DEG:  'fixed_longitude_degrees',
    FIXED_LON_MIN:  'fixed_longitude_minutes',
    FIXED_LON_SEC:  'fixed_longitude_seconds',
    FIXED_LON_DIR:  'fixed_longitude_dir',
    MOBILE_LAT_DEG: 'mobile_latitude_degrees',
    MOBILE_LAT_MIN: 'mobile_latitude_minutes',
    MOBILE_LAT_SEC: 'mobile_latitude_seconds',
    MOBILE_LAT_DIR: 'mobile_latitude_dir',
    MOBILE_LON_DEG: 'mobile_longitude_degrees',
    MOBILE_LON_MIN: 'mobile_longitude_minutes',
    MOBILE_LON_SEC: 'mobile_longitude_seconds',
    MOBILE_LON_DIR: 'mobile_longitude_dir',
    MOBILE_RADIUS:  'operation_radius',
    ASSIGNED:           'assigned',
    RENEWAL_TIMELINESS: 'renewal_timeliness',
    RENEWAL_DAYS:       'renewal_days',
    APP_URL:            'applicationUrl',
    EXHIBITS_URL:       'exhibitsUrl',
    CORRESPONDENCE_URL: 'correspondenceUrl'
  };

  // ============================================================
  // CONFIGURATION
  // ============================================================
  var CONFIG = {
    RADIUS_UNIT_KM: true,
    COLORS: {
      PRIMARY:  '#13418A',
      SUCCESS:  '#2e8540',
      DANGER:   '#ff253a',
      WARNING:  '#ffbe2e',
      NEUTRAL:  '#aeb0b5'
    },
    STATUS: {
      PENDING:  'Pending',
      SUBMITTED: 'Submitted',
      ASSIGNED: 'Assigned',
      REFERRED: 'Referred',
      GRANTED:  'Granted',
      DENIED:   'Denied/Dismissed',
      EXPIRED:  'Expired'
    },
    AGING_BUCKETS: [
      { label: '0-30d',   min: 0,   max: 30,  color: '#2e8540' },
      { label: '30-60d',  min: 30,  max: 60,  color: '#4aa564' },
      { label: '60-90d',  min: 60,  max: 90,  color: '#ffbe2e' },
      { label: '90-180d', min: 90,  max: 180, color: '#ff253a' },
      { label: '180d+',   min: 180, max: Infinity, color: '#981b1e' }
    ]
  };

  window.ElsDash.COLS = COLS;
  window.ElsDash.CONFIG = CONFIG;
})();
