Example 1. An isosceles trapezoid is inscribed in a semicircle with a radius of 1, where the lower base is the diameter of the semicircle. (1) Try to find the functional relationship between its perimeter \( \mathrm{y} \) and the leg length \( \mathrm{x} \), and write down the domain; (2) When the leg length is how much, does the perimeter have a maximum value? (This example is similar to the 1982 Tianjin Junior High School Mathematics Exam)