Dillard, Presiding Judge. In 2021, Baldwin County filed suit against the Department of Behavioral Health and Developmental Disabilities (“DBH”) and its commissioner, claiming that DBH had been assigned an intergovernmental contract, in which the former Department of Human Resources (“DHR”) paid the County to provide fire-protection services to the state-owned Central State Hospital in Milledgeville, but DBH breached this agreement by terminating it. DBH filed a motion to dismiss the complaint, arguing the County’s claims were barred by sovereign immunity. The trial court granted DBH’s motion as to the County’s claims for breach of contract and injunctive relief, but denied it as to the claims for mandamus and attorney fees. On appeal, the County contends the trial court erred in ruling that DBH was (1) not assigned as successor to the contract by an act of the General Assembly, and (2) not authorized by law to provide fire protection services, rendering the contract invalid under the Intergovernmental Contracts Clause of the Georgia Constitution.[1] The County further contends the trial court’s ruling that the contract did not apply to DBH violated the Georgia Constitution’s Impairment Clause,[2] and that the court erred in denying its motion for summary judgment as moot. For the following reasons, we affirm.[3] A motion to dismiss asserting sovereign immunity is based on the trial court’s “lack of subjectmatter jurisdiction, rather than the merits of the plaintiff’s claim.”[4] Put another way, sovereign immunity is not “an affirmative defense, going to the merits of the case, but raises the issue of the trial court’s subject matter jurisdiction to try the case.”[5] Significantly, a waiver of sovereign immunity “must be established by the party seeking to benefit from that waiver; thus, the plaintiffs have the burden of establishing waiver of sovereign immunity.”[6] And consequently, when reviewing a trial court’s ruling on a motion to dismiss on this basis, we do so “de novo while sustaining factual findings if they are supported by any evidence.”[7] With the foregoing in mind, the record shows that in 1999, Baldwin County and DHR entered into a long-term contract, in which DHR paid $550,000 annually for the County to provide fire-protection services to the state-owned and operated Central State Hospital in Milledgeville. Ten years later, the Georgia General Assembly reorganized various state agencies, eliminating DHR, creating DBH, and reestablishing the Department of Community Health (“DCH”).[8] Under this statutory reorganization, the various responsibilities of the now-defunct DHR were assigned to other agencies, including DBH and DCH.[9] Specifically, the General Assembly assigned DHR’s powers, functions, and duties “relating to the Division of Mental Health, Developmental Disabilities, and Addictive Diseases” to DBH.[10] And as part of the transfer of DHR’s responsibilities to the newly created DBH, the General Assembly provided in OCGA § 37-1-5 (b) that [t]he rights, privileges, entitlements, and duties of parties to contracts, leases, agreements, and other transactions entered into before July 1, 2009, by [DHR] which relate to the functions transferred to [DBH] pursuant to Code Section 3714 shall continue to exist; and none of these rights, privileges, entitlements, and duties are impaired or diminished by reason of the transfer of the functions to [DBH]. In all such instances, [DBH] shall be substituted for [DHR], and [DBH] shall succeed to the rights and duties under such contracts, leases, agreements, and other transactions. Additionally, the General Assembly assigned some of DHR’s responsibilities to DCH. Significantly, prior to DHR’s elimination in 2009, Title 25, Chapter 3 of the Georgia Code, concerning fire protection by local fire departments generally, designated DHR as one of the few state-level agencies that also had fire-protection duties under OCGA § 25-3-6: This article shall not affect the duties, powers, or responsibilities of the Safety Fire Commissioner, the state fire marshal, the sheriff’s office, the Department of Public Safety, local law enforcement agencies, the Department of Agriculture, the Department of Natural Resources, the Georgia Forestry Commission, the Department of Transportation, the Department of Defense, or the Department of Human Resources.[11] But following the 2009 agency restructuring, this statute was amended, substituting DCH as the specific agency replacing DHR.[12] And with further respect to DCH, in OCGA § 31-2-5 (d), the General Assembly provided: The rights, privileges, entitlements, and duties of parties to contracts, leases, agreements, and other transactions entered into before July 1, 2009, by any predecessor agency or unit and which pertain to the functions transferred to the department by this chapter shall continue to exist; and none of these rights, privileges, entitlements, and duties are impaired or diminished by reason of the transfer of the functions to the department. In all such instances, the Department of Community Health shall be substituted for the predecessor agency or unit, and the Department of Community Health shall succeed to the rights and duties under such contracts, leases, agreements, and other transactions. Despite this legislative shifting of agency responsibilities, for the next ten years, DBH continued performing under the original contract between the now-dissolved DHR and the County, remitting annual payments for the County’s provision of fire-protection services for Central State Hospital. But on September 16, 2020, the then-commissioner of DBH sent the County written notice that the agency was terminating the agreement, citing budget cuts and reduction of staff/patients at Central State Hospital. Shortly thereafter, the County responded via letter, disagreeing with DBH’s decision and asserting that the state agency was attempting to terminate a valid contract without legitimate reasons for doing so. Even so, as stated in its written notice, DBH ceased making payments to the County in October 2020. Subsequently, on July 15, 2021, the County filed suit against DBH and its commissioner, seeking damages, injunctive relief, specific performance, mandamus, and attorney fees based on allegations that DBH breached a valid intergovernmental contract when it ceased making payments under the agreement. DBH filed an answer, and a few months later, the agency filed a motion to dismiss the complaint, arguing the County’s claims were barred by sovereign immunity. Extensive briefing on the issue ensued, and the trial court ultimately held a hearing. After the hearing, the trial court granted DBH’s motion as to the County’s claims for breach of contract and injunctive relief, but denied it as to the claims for mandamus and attorney fees. This appeal follows. 1. Although separated into several enumerations, the County essentially contends the trial court erred in ruling that no valid intergovernmental contract existed between the County and DBH and, as a result, sovereign immunity barred the County’s claims for breach of contract and injunctive relief. We disagree. The Constitution of the State of Georgia provides that “sovereign immunity extends to the state and all of its departments and agencies and that the State’s sovereign immunity can only be waived by a constitutional provision or an act of the General Assembly that specifically provides for such a waiver and the extent thereof.”[13] And one of the exceptions to the defense of sovereign immunity is “for any action ex contractu for the breach of any written contract entered into by the state or its departments and agencies.”[14] But to satisfy this burden, the plaintiff must show that “the contract sought to be enforced is in writing and contains all of the terms necessary to constitute a valid contract.”[15] And here, the County argues it was a party to a valid intergovernmental contract with DBH, despite DHR’s dissolution, and the trial court erred in ruling otherwise. So, we turn our attention to that issue. In Georgia, the general rule regarding intergovernmental contracts is that a local government “may not enter into a contract that lasts longer than that government’s term of office.”[16] But the Intergovernmental Contracts Clause found in Article IX, Section III, Paragraph I (a) of the 1983 Georgia Constitution “provides an exception to that rule, and allows political subdivisions of the State to contract with one another or with other public agencies, so long as the term of the contract does not exceed 50 years.”[17] Specifically, Article IX, Section III, Paragraph I (a) provides: The state, or any institution, department, or other agency thereof, and any county, municipality, school district, or other political subdivision of the state may contract for any period not exceeding 50 years with each other or with any other public agency, public corporation, or public authority for joint services, for the provision of services, or for the joint or separate use of facilities or equipment; but such contracts must deal with activities, services, or facilities which the contracting parties are authorized by law to undertake or provide. But this exception does not give the State and its institutions and subdivisions the authority to “enter into any and every contract which they might in their discretion deem advisable.”[18] Rather, construing the foregoing constitutional text, the Supreme Court of Georgia has held that an agreement must meet two requirements—i.e., “involve the provision of services, or the joint or separate use of facilities or equipment and deal with activities, services, or facilities which the contracting parties are authorized by law to undertake or provide.”[19] Here, DBH argued—and the trial court agreed—that the contract was invalid because the County failed to show it involved services DBH was authorized by law to provide. And in light of the 2009 statutes eliminating DHR and creating DBH, we are similarly persuaded. Indeed, affording the text of those statutes their plain and ordinary meaning,[20] the General Assembly explicitly assigned DHR’s powers, functions, and duties “relating to the Division of Mental Health, Developmental Disabilities, and Addictive Diseases”[21] to DBH. And while OCGA § 37-1-5 (b) assigned some of former DHR’s contract responsibilities to DBH, it did so only with regard to those “which relate to the functions transferred to [DBH].”[22] Significantly, those functions did not include fire-protection services. Thus, while it is certainly true that, prior to its elimination, DHR was one of the few state-level agencies granted authority to provide fire-protection services, the statutory basis for that duty after DHR was eliminated explicitly substituted DCH to fulfill DHR’s former role[23]—leading to the textual inference that DBH was not granted similar authority.[24] In fact, as the trial court acknowledged, none of the relevant 2009 statutory provisions—eliminating DHR, creating DBH, and reestablishing DCH—granted DBH the authority to provide fire-protection services. Moreover, the only specific mention of Central State Hospital within the article outlining the powers and duties of DBH makes no reference to fire-protection services.[25] Given these circumstances, the trial court did not err in ruling that sovereign immunity barred the County’s claims for breach of contract and injunctive relief on the ground that DBH lacked authority to provide fire-protection services; and so no valid intergovernmental contract exists between the County and DBH regarding such services.[26] 2. The County further contends the trial court’s ruling that the contract did not apply to DBH violated the Georgia Constitution’s Impairment Clause. Once again, we disagree. The Impairment Clause of the Constitution of the State of Georgia, Article I, Section 1, Paragraph X, provides: “No bill of attainder, ex post facto law, retroactive law, or laws impairing the obligation of contract or making irrevocable grant of special privileges or immunities shall be passed.” And to determine whether there has been a violation of Georgia’s Impairment Clause, we consider whether “a vested right exists and then whether that vested right has been ‘injuriously affected’ by the law in question.”[27] Here, it is undisputed that, prior to 2009, the County had a valid intergovernmental contract with DHR. But as previously discussed, following the General Assembly’s elimination of DHR and reorganization of various state agencies, the responsibility to perform under that contract was not assigned to DBH. Rather, the plain language of the various reorganization statutes seems to indicate that this responsibility was assigned, at least initially, to DCH.[28] Accordingly, in light of this statutory context, and applying the canon that “[s]tatutes should be interpreted to avoid serious constitutional concerns where such an interpretation is reasonable[,]“[29] the Georgia Constitution’s Impairment Clause is not violated because the agreement does not apply to or bind DBH, as the contract seemingly was assigned to another agency.[30] 3. Finally, the County contends the trial court erred in denying its motion for partial summary judgment on its breach-of-contract claim as moot. But given our holding that the trial court did not err in granting DBH’s motion to dismiss, this issue is indeed moot. For all these reasons, the trial court’s judgment is affirmed. Judgment affirmed. Brown and Padgett, JJ., concur.