Time-reversal equivariant neural network potential and Hamiltonian for magnetic materials