A new configuration is required to model the behavior of customers, aggregators, the distribution system operator (DSO), and their interactions due to the active participation of customers in the local flexibility market. To this end, we propose a two-layer game-based framework that models agents' behavior and their interactions. Thus, firstly, at the inner layer, customers and aggregators set their decision variables considering the decisions of each other performing an iterative game. After the inner layer game concludes, in the outer layer, the DSO determines its decision variable according to the decision of aggregators and customers. If the convergence condition is satisfied, the game of the outer layer concludes. Otherwise, there is another inner game and subsequent outer game until the satisfaction of convergence condition. Therefor, customers, aggregators, and the DSO have similar decision-making power. Since all of This article has been accepted for publication in IEEE Access.