Context.The excitation of the filamentary gas structures surrounding giant elliptical galaxies at the center of cool-core clusters, also known as brightest cluster galaxies (BCGs), is key to our understanding of active galactic nucleus (AGN) feedback, and of the impact of environmental and local effects on star formation.Aims.We investigate the contribution of thermal radiation from the cooling flow surrounding BCGs to the excitation of the filaments. We explore the effects of small levels of extra heating (turbulence), and of metallicity, on the optical and infrared lines.Methods.Using the CLOUDYcode, we modeled the photoionization and photodissociation of a slab of gas of optical depthAV ≤ 30 mag at constant pressure in order to calculate self-consistently all of the gas phases, from ionized gas to molecular gas. The ionizing source is the extreme ultraviolet (EUV) and soft X-ray radiation emitted by the cooling gas. We tested these models comparing their predictions to the rich multi-wavelength observations from optical to submillimeter, now achieved in cool core clusters.Results.Such models of self-irradiated clouds, when reaching sufficiently largeAV, lead to a cloud structure with ionized, atomic, and molecular gas phases. These models reproduce most of the multi-wavelength spectra observed in the nebulae surrounding the BCGs, not only the low-ionization nuclear emission region like optical diagnostics, [O III]λ5007 Å/Hβ, [N II]λ6583 Å/Hα, and ([S II]λ6716 Å+[S II]λ6731 Å)/Hα, but also the infrared emission lines from the atomic gas. [O I]λ6300 Å/Hα, instead, is overestimated across the full parameter space, except for very lowAV. The modeled ro-vibrational H2lines also match observations, which indicates that near- and mid-infrared H2lines are mostly excited by collisions between H2molecules and secondary electrons produced naturally inside the cloud by the interaction between the X-rays and the cold gas in the filament. However, there is still some tension between ionized and molecular line tracers (i.e., CO), which requires optimization of the cloud structure and the density of the molecular zone. The limited range of parameters over which predictions match observations allows us to constrain, in spite of degeneracies in the parameter space, the intensity of X-ray radiation bathing filaments, as well as some of their physical properties likeAVor the level of turbulent heating rate.Conclusions.The reprocessing of the EUV and X-ray radiation from the plasma cooling is an important powering source of line emission from filaments surrounding BCGs. CLOUDYself-irradiated X-ray excitation models coupled with a small level of turbulent heating manage to simultaneously reproduce a large number of optical-to-infrared line ratios when all the gas phases (from ionized to molecular) are modeled self-consistently. Releasing some of the simplifications of our model, like the constant pressure, or adding the radiation fields from the AGN and stars, as well as a combination of matter- and radiation-bounded cloud distribution, should improve the predictions of line emission from the different gas phases.