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

package com.azure.resourcemanager.security.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.security.fluent.models.GovernanceAssignmentProperties;
import com.azure.resourcemanager.security.models.GovernanceAssignmentAdditionalData;
import com.azure.resourcemanager.security.models.GovernanceEmailNotification;
import com.azure.resourcemanager.security.models.RemediationEta;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;

public final class GovernanceAssignmentPropertiesTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GovernanceAssignmentProperties model =
            BinaryData
                .fromString(
                    "{\"owner\":\"ifgh\",\"remediationDueDate\":\"2021-06-10T17:08:41Z\",\"remediationEta\":{\"eta\":\"2021-08-19T14:37:02Z\",\"justification\":\"qtlffhzbk\"},\"isGracePeriod\":true,\"governanceEmailNotification\":{\"disableManagerEmailNotification\":true,\"disableOwnerEmailNotification\":true},\"additionalData\":{\"ticketNumber\":1233073634,\"ticketLink\":\"nq\",\"ticketStatus\":\"wdogiyetesyp\"}}")
                .toObject(GovernanceAssignmentProperties.class);
        Assertions.assertEquals("ifgh", model.owner());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T17:08:41Z"), model.remediationDueDate());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-19T14:37:02Z"), model.remediationEta().eta());
        Assertions.assertEquals("qtlffhzbk", model.remediationEta().justification());
        Assertions.assertEquals(true, model.isGracePeriod());
        Assertions.assertEquals(true, model.governanceEmailNotification().disableManagerEmailNotification());
        Assertions.assertEquals(true, model.governanceEmailNotification().disableOwnerEmailNotification());
        Assertions.assertEquals(1233073634, model.additionalData().ticketNumber());
        Assertions.assertEquals("nq", model.additionalData().ticketLink());
        Assertions.assertEquals("wdogiyetesyp", model.additionalData().ticketStatus());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GovernanceAssignmentProperties model =
            new GovernanceAssignmentProperties()
                .withOwner("ifgh")
                .withRemediationDueDate(OffsetDateTime.parse("2021-06-10T17:08:41Z"))
                .withRemediationEta(
                    new RemediationEta()
                        .withEta(OffsetDateTime.parse("2021-08-19T14:37:02Z"))
                        .withJustification("qtlffhzbk"))
                .withIsGracePeriod(true)
                .withGovernanceEmailNotification(
                    new GovernanceEmailNotification()
                        .withDisableManagerEmailNotification(true)
                        .withDisableOwnerEmailNotification(true))
                .withAdditionalData(
                    new GovernanceAssignmentAdditionalData()
                        .withTicketNumber(1233073634)
                        .withTicketLink("nq")
                        .withTicketStatus("wdogiyetesyp"));
        model = BinaryData.fromObject(model).toObject(GovernanceAssignmentProperties.class);
        Assertions.assertEquals("ifgh", model.owner());
        Assertions.assertEquals(OffsetDateTime.parse("2021-06-10T17:08:41Z"), model.remediationDueDate());
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-19T14:37:02Z"), model.remediationEta().eta());
        Assertions.assertEquals("qtlffhzbk", model.remediationEta().justification());
        Assertions.assertEquals(true, model.isGracePeriod());
        Assertions.assertEquals(true, model.governanceEmailNotification().disableManagerEmailNotification());
        Assertions.assertEquals(true, model.governanceEmailNotification().disableOwnerEmailNotification());
        Assertions.assertEquals(1233073634, model.additionalData().ticketNumber());
        Assertions.assertEquals("nq", model.additionalData().ticketLink());
        Assertions.assertEquals("wdogiyetesyp", model.additionalData().ticketStatus());
    }
}
