// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.machinelearning.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.machinelearning.models.InputDeliveryMode;
import com.azure.resourcemanager.machinelearning.models.LogVerbosity;
import com.azure.resourcemanager.machinelearning.models.MLTableJobInput;
import com.azure.resourcemanager.machinelearning.models.NlpVerticalFeaturizationSettings;
import com.azure.resourcemanager.machinelearning.models.NlpVerticalLimitSettings;
import com.azure.resourcemanager.machinelearning.models.TextNer;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class TextNerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TextNer model =
            BinaryData
                .fromString(
                    "{\"taskType\":\"TextNER\",\"primaryMetric\":\"PrecisionScoreWeighted\",\"featurizationSettings\":{\"datasetLanguage\":\"zgjypanhxmpdxxz\"},\"limitSettings\":{\"maxConcurrentTrials\":1172972444,\"maxTrials\":1745453139,\"timeout\":\"PT16H13M18S\"},\"validationData\":{\"jobInputType\":\"mltable\",\"mode\":\"ReadWriteMount\",\"uri\":\"lkfhglhrfoxqwec\",\"description\":\"nhpcselqx\"},\"logVerbosity\":\"Critical\",\"targetColumnName\":\"qibukklvzrl\",\"trainingData\":{\"jobInputType\":\"mltable\",\"mode\":\"Download\",\"uri\":\"ccmetjsczivfqb\",\"description\":\"asdsyenzsie\"}}")
                .toObject(TextNer.class);
        Assertions.assertEquals(LogVerbosity.CRITICAL, model.logVerbosity());
        Assertions.assertEquals("qibukklvzrl", model.targetColumnName());
        Assertions.assertEquals("asdsyenzsie", model.trainingData().description());
        Assertions.assertEquals(InputDeliveryMode.DOWNLOAD, model.trainingData().mode());
        Assertions.assertEquals("ccmetjsczivfqb", model.trainingData().uri());
        Assertions.assertEquals("zgjypanhxmpdxxz", model.featurizationSettings().datasetLanguage());
        Assertions.assertEquals(1172972444, model.limitSettings().maxConcurrentTrials());
        Assertions.assertEquals(1745453139, model.limitSettings().maxTrials());
        Assertions.assertEquals(Duration.parse("PT16H13M18S"), model.limitSettings().timeout());
        Assertions.assertEquals("nhpcselqx", model.validationData().description());
        Assertions.assertEquals(InputDeliveryMode.READ_WRITE_MOUNT, model.validationData().mode());
        Assertions.assertEquals("lkfhglhrfoxqwec", model.validationData().uri());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TextNer model =
            new TextNer()
                .withLogVerbosity(LogVerbosity.CRITICAL)
                .withTargetColumnName("qibukklvzrl")
                .withTrainingData(
                    new MLTableJobInput()
                        .withDescription("asdsyenzsie")
                        .withMode(InputDeliveryMode.DOWNLOAD)
                        .withUri("ccmetjsczivfqb"))
                .withFeaturizationSettings(
                    new NlpVerticalFeaturizationSettings().withDatasetLanguage("zgjypanhxmpdxxz"))
                .withLimitSettings(
                    new NlpVerticalLimitSettings()
                        .withMaxConcurrentTrials(1172972444)
                        .withMaxTrials(1745453139)
                        .withTimeout(Duration.parse("PT16H13M18S")))
                .withValidationData(
                    new MLTableJobInput()
                        .withDescription("nhpcselqx")
                        .withMode(InputDeliveryMode.READ_WRITE_MOUNT)
                        .withUri("lkfhglhrfoxqwec"));
        model = BinaryData.fromObject(model).toObject(TextNer.class);
        Assertions.assertEquals(LogVerbosity.CRITICAL, model.logVerbosity());
        Assertions.assertEquals("qibukklvzrl", model.targetColumnName());
        Assertions.assertEquals("asdsyenzsie", model.trainingData().description());
        Assertions.assertEquals(InputDeliveryMode.DOWNLOAD, model.trainingData().mode());
        Assertions.assertEquals("ccmetjsczivfqb", model.trainingData().uri());
        Assertions.assertEquals("zgjypanhxmpdxxz", model.featurizationSettings().datasetLanguage());
        Assertions.assertEquals(1172972444, model.limitSettings().maxConcurrentTrials());
        Assertions.assertEquals(1745453139, model.limitSettings().maxTrials());
        Assertions.assertEquals(Duration.parse("PT16H13M18S"), model.limitSettings().timeout());
        Assertions.assertEquals("nhpcselqx", model.validationData().description());
        Assertions.assertEquals(InputDeliveryMode.READ_WRITE_MOUNT, model.validationData().mode());
        Assertions.assertEquals("lkfhglhrfoxqwec", model.validationData().uri());
    }
}
