If the court determines that an agency willfully or with wanton disregard violated a provision of this chapter, in whole or in part, the court shall award the prevailing party reasonable attorney fees and costs of litigation or an appropriate portion of the fees and costs. If the court finds that the legal challenge was of a frivolous nature or was brought with no substantial justification, the court shall award the prevailing party reasonable attorney fees and costs of litigation or an appropriate portion of the fees and costs.
65 Pa.C.S. § 714.1