lib/wolf_core/application/barton/mappings.rb



module WolfCore
  module Barton
    module Mappings
      PROVIDER_TYPE_MAPPING = {
        'MD' => ENV['MD_PRICING_ID'],
        'DO' => ENV['DO_PRICING_ID'],
        'PA' => ENV['PA_PRICING_ID'],
        'DMD' => ENV['DMD_PRICING_ID'],
        'NP' => ENV['NP_PRICING_ID'],
        'DDS' => ENV['DDS_PRICING_ID'],
        'GP' => ENV['GP_PRICING_ID'],
      }

      LOCUM_AVAILABILITY_MAP = {
        'PT' => 'Part Time',
        'FT' => 'Full Time',
        'PFI' => 'Not Sure Yet',
        'Interim Locum' => 'Between Permanent Positions',
        'Perm Only' => 'Permanent',
      }

      ORDER_STATUS_MAP = {
        'Listing Qualification' => 'pending',
        'Pending' => 'pending',
        'On Hold' => 'pending',
        'Filled' => 'pending',
        'Open' => 'live',
        'Closed' => 'pending',
      }

      SUBMITTAL_STAGE_MAP = {
        'Pre-Submission' => 'wait',
        'Submittal' => 'wait',
        'Send Out' => 'wait',
        'On Hold' => 'wait',
        'Offer' => 'wait',
        'Applied Online' => 'wait',
        'Declined Online' => 'declined',
        'Withdraw' => 'declined',
        'Reject' => 'rejected',
      }

      STATE_ABBREVIATIONS_MAP = {
        "Alabama"=>"AL",
        "Alaska"=>"AK",
        "Arizona"=>"AZ",
        "Arkansas"=>"AR",
        "California"=>"CA",
        "Colorado"=>"CO",
        "Connecticut"=>"CT",
        "Delaware"=>"DE",
        "Florida"=>"FL",
        "Georgia"=>"GA",
        "Hawaii"=>"HI",
        "Idaho"=>"ID",
        "Illinois"=>"IL",
        "Indiana"=>"IN",
        "Iowa"=>"IA",
        "Kansas"=>"KS",
        "Kentucky"=>"KY",
        "Louisiana"=>"LA",
        "Maine"=>"ME",
        "Maryland"=>"MD",
        "Massachusetts"=>"MA",
        "Michigan"=>"MI",
        "Minnesota"=>"MN",
        "Mississippi"=>"MS",
        "Missouri"=>"MO",
        "Montana"=>"MT",
        "Nebraska"=>"NE",
        "Nevada"=>"NV",
        "New Hampshire"=>"NH",
        "New Jersey"=>"NJ",
        "New Mexico"=>"NM",
        "New York"=>"NY",
        "North Carolina"=>"NC",
        "North Dakota"=>"ND",
        "Ohio"=>"OH",
        "Oklahoma"=>"OK",
        "Oregon"=>"OR",
        "Pennsylvania"=>"PA",
        "Rhode Island"=>"RI",
        "South Carolina"=>"SC",
        "South Dakota"=>"SD",
        "Tennessee"=>"TN",
        "Texas"=>"TX",
        "Utah"=>"UT",
        "Vermont"=>"VT",
        "Virginia"=>"VA",
        "Washington"=>"WA",
        "West Virginia"=>"WV",
        "Wisconsin"=>"WI",
        "Wyoming"=>"WY",
      }

      def map_provider_type_to_pricing_id(provider_type)
        pricing_id = PROVIDER_TYPE_MAPPING[provider_type]
        pricing_id || provider_type
      end

      def map_pricing_id_to_provider_type(pricing_id)
        return nil if pricing_id.blank?
        pricing_id = pricing_id.to_s
        provider_type = PROVIDER_TYPE_MAPPING.invert[pricing_id]
        provider_type || pricing_id
      end

      def map_locum_availability(value)
        LOCUM_AVAILABILITY_MAP[value] || value
      end

      def reverse_map_locum_availability(value)
        LOCUM_AVAILABILITY_MAP.invert[value] || value
      end

      def map_order_status(value)
        ORDER_STATUS_MAP[value] || value
      end

      def reverse_map_order_status(value)
        ORDER_STATUS_MAP.invert[value] || value
      end

      def map_submittal_stage_to_order_application_status(value)
        SUBMITTAL_STAGE_MAP[value] || value
      end

      def revert_map_submittal_stage_to_order_application_status(value)
        SUBMITTAL_STAGE_MAP.invert[value] || value
      end

      def map_state_to_abbreviation(value)
        STATE_ABBREVIATIONS_MAP[value] || value
      end

      def revert_map_state_to_abbreviation(value)
        STATE_ABBREVIATIONS_MAP.invert[value] || value
      end
    end
  end
end