I am studying the Fourier expansion (Mandel&Wolf; Pag. 467.) of the potential vector $A(\textbf{r},t)$ with respect to its space variables $x$, $y$, $z$. We have confined the field in a cubic cavity of side $L$ with which we can impose periodic boundary conditions. Then, $A(\textbf{r},t)$ can be taken in a three-dimensional Fourier expansion according to
$$\textbf{A}(\textbf{r},t)=\frac{1}{\epsilon_{0}^{3/2}L^{3/2}}\sum_{\textbf{k}}\mathcal{A}_{\textbf{k}}(t) e^{i \textbf{k}\cdot \textbf{r}}, \tag{1}$$
where $\mathcal{A}_{\textbf{k}}(t)$ is complex time-dependent amplitude, $\epsilon_{0}$ is the vaccum dielectric constant, and $\textbf{k}$ is the wave number vector, which has components $k_{1}$, $k_{2}$, $k_{3}$ that can take restringed values according to
$$k_{1}=2\pi n_{1}/L, \quad \quad n_{1}=0,\pm 1, \pm2, \pm3, \cdots \tag{2}$$ $$k_{2}=2\pi n_{1}/L, \quad \quad n_{2}=0,\pm 1, \pm2, \pm3, \cdots \tag{3}$$ $$k_{3}=2\pi n_{1}/L, \quad \quad n_{3}=0,\pm 1, \pm2, \pm3, \cdots \tag{4}$$
which can be obtained from the equation (for example, for the $x$ component): $e^{i k_{1}x} = e^{i k_{1}(x+L)}$ and applying the boundary conditions at $x=0$ and $x=L$. According to Mandel&Wolf, the $\sum_{\textbf{k}}$ in Eq. (1) is understood to be a sum over the integers $n_{1}, n_{2}, n_{3}$. This fact is causing me a little confusion regarding the interpretation of the sum in Eq. (1). For example, I understand that Eq. (1) can be written as
$$\textbf{A}(\textbf{r},t)=\frac{1}{\epsilon_{0}^{3/2}L^{3/2}}\left( \mathcal{A}_{\textbf{k}_{1}}(t) e^{i \textbf{k}_{1}\cdot \textbf{r}} + \mathcal{A}_{\textbf{k}_{2}}(t) e^{i \textbf{k}_{2}\cdot \textbf{r}} + \mathcal{A}_{\textbf{k}_{3}}(t) e^{i \textbf{k}_{3}\cdot \textbf{r}} + \cdots\right) \tag{5}$$ where each vector $\textbf{k}_{i}$ has components $k_{1}, k_{2}, k_{3}$; that is, $\textbf{k}_{i}=(k_{1}, k_{2}, k_{3})_{i}$. Then, my questions are
(1) Am I interpreting correctly Eq. (1) as is expanded in Eq. (5)?
if so
(2) How I can take Eq. (5) to expand it in terms of the $x, y$, and $z$ and then apply the boundary conditions that allow me to obtain the conditions given by Eqs. (2)-(4)?