/*
 * Copyright 2025 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

using Google.Cloud.ModelArmor.V1;
using Xunit;
using Xunit.Abstractions;

namespace ModelArmor.Samples.Tests
{
    [Collection("FloorSettingCollection")]
    public class GetOrganizationFloorSettingsTests : IClassFixture<FloorSettingFixture>
    {
        private readonly FloorSettingFixture _fixture;
        private readonly GetOrganizationFloorSettings _sample;
        private readonly ITestOutputHelper _output;

        public GetOrganizationFloorSettingsTests(
            FloorSettingFixture fixture,
            ITestOutputHelper output
        )
        {
            _fixture = fixture;
            _sample = new GetOrganizationFloorSettings();
            _output = output;
        }

        [Fact]
        public void GetOrganizationFloorSettingTest()
        {
            // Get organization ID from environment variable
            string organizationId = _fixture.GetRequiredEnvVar("MA_ORG_ID");

            // Run the sample
            FloorSetting response = _sample.GetOrganizationFloorSetting(organizationId);

            // Verify response
            Assert.NotNull(response);
            Assert.Equal(
                $"organizations/{organizationId}/locations/global/floorSetting",
                response.Name
            );
        }
    }
}
