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

package com.azure.resourcemanager.education.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.education.fluent.models.Amount;
import com.azure.resourcemanager.education.fluent.models.StudentDetailsInner;
import com.azure.resourcemanager.education.models.StudentRole;
import java.time.OffsetDateTime;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

public final class StudentDetailsInnerTests {
    @Test
    public void testDeserialize() {
        StudentDetailsInner model =
            BinaryData
                .fromString(
                    "{\"properties\":{\"firstName\":\"eju\",\"lastName\":\"fqawrlyxw\",\"email\":\"kcprbnw\",\"role\":\"Student\",\"budget\":{\"currency\":\"jvtbvpyss\",\"value\":20.533592},\"subscriptionId\":\"uj\",\"expirationDate\":\"2021-07-18T17:10:22Z\",\"status\":\"Disabled\",\"effectiveDate\":\"2021-02-09T18:19:16Z\",\"subscriptionAlias\":\"uqfprwzw\",\"subscriptionInviteLastSentDate\":\"2021-02-13T16:28:59Z\"},\"id\":\"itnwuizgazxufi\",\"name\":\"uckyf\",\"type\":\"hr\"}")
                .toObject(StudentDetailsInner.class);
        Assertions.assertEquals("eju", model.firstName());
        Assertions.assertEquals("fqawrlyxw", model.lastName());
        Assertions.assertEquals("kcprbnw", model.email());
        Assertions.assertEquals(StudentRole.STUDENT, model.role());
        Assertions.assertEquals("jvtbvpyss", model.budget().currency());
        Assertions.assertEquals(20.533592F, model.budget().value());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-18T17:10:22Z"), model.expirationDate());
        Assertions.assertEquals("uqfprwzw", model.subscriptionAlias());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-13T16:28:59Z"), model.subscriptionInviteLastSentDate());
    }

    @Test
    public void testSerialize() {
        StudentDetailsInner model =
            new StudentDetailsInner()
                .withFirstName("eju")
                .withLastName("fqawrlyxw")
                .withEmail("kcprbnw")
                .withRole(StudentRole.STUDENT)
                .withBudget(new Amount().withCurrency("jvtbvpyss").withValue(20.533592F))
                .withExpirationDate(OffsetDateTime.parse("2021-07-18T17:10:22Z"))
                .withSubscriptionAlias("uqfprwzw")
                .withSubscriptionInviteLastSentDate(OffsetDateTime.parse("2021-02-13T16:28:59Z"));
        model = BinaryData.fromObject(model).toObject(StudentDetailsInner.class);
        Assertions.assertEquals("eju", model.firstName());
        Assertions.assertEquals("fqawrlyxw", model.lastName());
        Assertions.assertEquals("kcprbnw", model.email());
        Assertions.assertEquals(StudentRole.STUDENT, model.role());
        Assertions.assertEquals("jvtbvpyss", model.budget().currency());
        Assertions.assertEquals(20.533592F, model.budget().value());
        Assertions.assertEquals(OffsetDateTime.parse("2021-07-18T17:10:22Z"), model.expirationDate());
        Assertions.assertEquals("uqfprwzw", model.subscriptionAlias());
        Assertions.assertEquals(OffsetDateTime.parse("2021-02-13T16:28:59Z"), model.subscriptionInviteLastSentDate());
    }
}
