Electronic structure, magnetic and optical properties of the Ba7(BO3)4−xF2+3x crystal