# frozen_string_literal: true
class Maintenance::CompanyStatusTransitTask < MaintenanceTasks::Task
csv_collection
attribute :status_to, :string
validates :status_to, presence: true, inclusion: TreeNodes::Statuses.list
def process(row)
::Filters::TreeNodes.new(mbo_attributes: extract_row_attributes(row))
.fetch
.sole
.update!(status: status_to)
end
private
def extract_row_attributes(row)
{
mbo_id: row.field('MBO_ID'),
mbo_country_code: row.field('MBO_COUNTRY_CODE')
}
end
end