// 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.GovernanceAssignmentInner;
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 GovernanceAssignmentInnerTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        GovernanceAssignmentInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"owner\":\"wzfgbrttuiaclkie\",\"remediationDueDate\":\"2021-01-24T04:29:25Z\",\"remediationEta\":{\"eta\":\"2021-03-15T08:06:52Z\",\"justification\":\"lfnthiqfyut\"},\"isGracePeriod\":false,\"governanceEmailNotification\":{\"disableManagerEmailNotification\":false,\"disableOwnerEmailNotification\":false},\"additionalData\":{\"ticketNumber\":1375874232,\"ticketLink\":\"mtx\",\"ticketStatus\":\"ctwwgzw\"}},\"id\":\"jlmec\",\"name\":\"og\",\"type\":\"gzyvnee\"}")
                .toObject(GovernanceAssignmentInner.class);
        Assertions.assertEquals("wzfgbrttuiaclkie", model.owner());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-24T04:29:25Z"), model.remediationDueDate());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-15T08:06:52Z"), model.remediationEta().eta());
        Assertions.assertEquals("lfnthiqfyut", model.remediationEta().justification());
        Assertions.assertEquals(false, model.isGracePeriod());
        Assertions.assertEquals(false, model.governanceEmailNotification().disableManagerEmailNotification());
        Assertions.assertEquals(false, model.governanceEmailNotification().disableOwnerEmailNotification());
        Assertions.assertEquals(1375874232, model.additionalData().ticketNumber());
        Assertions.assertEquals("mtx", model.additionalData().ticketLink());
        Assertions.assertEquals("ctwwgzw", model.additionalData().ticketStatus());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        GovernanceAssignmentInner model =
            new GovernanceAssignmentInner()
                .withOwner("wzfgbrttuiaclkie")
                .withRemediationDueDate(OffsetDateTime.parse("2021-01-24T04:29:25Z"))
                .withRemediationEta(
                    new RemediationEta()
                        .withEta(OffsetDateTime.parse("2021-03-15T08:06:52Z"))
                        .withJustification("lfnthiqfyut"))
                .withIsGracePeriod(false)
                .withGovernanceEmailNotification(
                    new GovernanceEmailNotification()
                        .withDisableManagerEmailNotification(false)
                        .withDisableOwnerEmailNotification(false))
                .withAdditionalData(
                    new GovernanceAssignmentAdditionalData()
                        .withTicketNumber(1375874232)
                        .withTicketLink("mtx")
                        .withTicketStatus("ctwwgzw"));
        model = BinaryData.fromObject(model).toObject(GovernanceAssignmentInner.class);
        Assertions.assertEquals("wzfgbrttuiaclkie", model.owner());
        Assertions.assertEquals(OffsetDateTime.parse("2021-01-24T04:29:25Z"), model.remediationDueDate());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-15T08:06:52Z"), model.remediationEta().eta());
        Assertions.assertEquals("lfnthiqfyut", model.remediationEta().justification());
        Assertions.assertEquals(false, model.isGracePeriod());
        Assertions.assertEquals(false, model.governanceEmailNotification().disableManagerEmailNotification());
        Assertions.assertEquals(false, model.governanceEmailNotification().disableOwnerEmailNotification());
        Assertions.assertEquals(1375874232, model.additionalData().ticketNumber());
        Assertions.assertEquals("mtx", model.additionalData().ticketLink());
        Assertions.assertEquals("ctwwgzw", model.additionalData().ticketStatus());
    }
}
