require_relative "base"


module Validators
  module FieldValidator
    class ProviderAccount < Base

      def valid?
        accounts = ::Provider::AccountsFactory.accounts(@model.provider)
        accounts.map{|a| a.account_name}.include?(@value)
      end

      def message
        "Account '#{@value}' for provider '#{@model.provider}' does not exist"
      end
    end
  end
end
