Electronic, optical and thermoelectric properties of XNMg3 (X=P, As, Sb, Bi) compounds