// 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.TextClassificationMultilabel;
import java.time.Duration;
import org.junit.jupiter.api.Assertions;

public final class TextClassificationMultilabelTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        TextClassificationMultilabel model =
            BinaryData
                .fromString(
                    "{\"taskType\":\"TextClassificationMultilabel\",\"primaryMetric\":\"AveragePrecisionScoreWeighted\",\"featurizationSettings\":{\"datasetLanguage\":\"klt\"},\"limitSettings\":{\"maxConcurrentTrials\":1366135748,\"maxTrials\":1224275689,\"timeout\":\"PT25H21M12S\"},\"validationData\":{\"jobInputType\":\"mltable\",\"mode\":\"EvalDownload\",\"uri\":\"grdcgubsrtmdy\",\"description\":\"erpi\"},\"logVerbosity\":\"Warning\",\"targetColumnName\":\"zgczfcmfpfbode\",\"trainingData\":{\"jobInputType\":\"mltable\",\"mode\":\"Direct\",\"uri\":\"sr\",\"description\":\"tshuvftwaivm\"}}")
                .toObject(TextClassificationMultilabel.class);
        Assertions.assertEquals(LogVerbosity.WARNING, model.logVerbosity());
        Assertions.assertEquals("zgczfcmfpfbode", model.targetColumnName());
        Assertions.assertEquals("tshuvftwaivm", model.trainingData().description());
        Assertions.assertEquals(InputDeliveryMode.DIRECT, model.trainingData().mode());
        Assertions.assertEquals("sr", model.trainingData().uri());
        Assertions.assertEquals("klt", model.featurizationSettings().datasetLanguage());
        Assertions.assertEquals(1366135748, model.limitSettings().maxConcurrentTrials());
        Assertions.assertEquals(1224275689, model.limitSettings().maxTrials());
        Assertions.assertEquals(Duration.parse("PT25H21M12S"), model.limitSettings().timeout());
        Assertions.assertEquals("erpi", model.validationData().description());
        Assertions.assertEquals(InputDeliveryMode.EVAL_DOWNLOAD, model.validationData().mode());
        Assertions.assertEquals("grdcgubsrtmdy", model.validationData().uri());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        TextClassificationMultilabel model =
            new TextClassificationMultilabel()
                .withLogVerbosity(LogVerbosity.WARNING)
                .withTargetColumnName("zgczfcmfpfbode")
                .withTrainingData(
                    new MLTableJobInput()
                        .withDescription("tshuvftwaivm")
                        .withMode(InputDeliveryMode.DIRECT)
                        .withUri("sr"))
                .withFeaturizationSettings(new NlpVerticalFeaturizationSettings().withDatasetLanguage("klt"))
                .withLimitSettings(
                    new NlpVerticalLimitSettings()
                        .withMaxConcurrentTrials(1366135748)
                        .withMaxTrials(1224275689)
                        .withTimeout(Duration.parse("PT25H21M12S")))
                .withValidationData(
                    new MLTableJobInput()
                        .withDescription("erpi")
                        .withMode(InputDeliveryMode.EVAL_DOWNLOAD)
                        .withUri("grdcgubsrtmdy"));
        model = BinaryData.fromObject(model).toObject(TextClassificationMultilabel.class);
        Assertions.assertEquals(LogVerbosity.WARNING, model.logVerbosity());
        Assertions.assertEquals("zgczfcmfpfbode", model.targetColumnName());
        Assertions.assertEquals("tshuvftwaivm", model.trainingData().description());
        Assertions.assertEquals(InputDeliveryMode.DIRECT, model.trainingData().mode());
        Assertions.assertEquals("sr", model.trainingData().uri());
        Assertions.assertEquals("klt", model.featurizationSettings().datasetLanguage());
        Assertions.assertEquals(1366135748, model.limitSettings().maxConcurrentTrials());
        Assertions.assertEquals(1224275689, model.limitSettings().maxTrials());
        Assertions.assertEquals(Duration.parse("PT25H21M12S"), model.limitSettings().timeout());
        Assertions.assertEquals("erpi", model.validationData().description());
        Assertions.assertEquals(InputDeliveryMode.EVAL_DOWNLOAD, model.validationData().mode());
        Assertions.assertEquals("grdcgubsrtmdy", model.validationData().uri());
    }
}
