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

package com.azure.resourcemanager.postgresqlflexibleserver.generated;

import com.azure.core.util.BinaryData;
import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner;
import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFileListResult;
import java.time.OffsetDateTime;
import java.util.Arrays;
import org.junit.jupiter.api.Assertions;

public final class LogFileListResultTests {
    @org.junit.jupiter.api.Test
    public void testDeserialize() throws Exception {
        LogFileListResult model =
            BinaryData
                .fromString(
                    "{\"value\":[{\"properties\":{\"createdTime\":\"2021-08-30T19:00:32Z\",\"lastModifiedTime\":\"2021-03-25T00:29:47Z\",\"sizeInKb\":404870877224643205,\"type\":\"sqfsubcgjbirxb\",\"url\":\"bsrfbj\"},\"id\":\"twss\",\"name\":\"t\",\"type\":\"tpvjzbexilzznfqq\"},{\"properties\":{\"createdTime\":\"2021-08-29T16:58:02Z\",\"lastModifiedTime\":\"2021-09-17T08:06:16Z\",\"sizeInKb\":7676995030931016800,\"type\":\"oujmkcjhwqytj\",\"url\":\"bnw\"},\"id\":\"wgdrjervnaenqp\",\"name\":\"hin\",\"type\":\"oygmift\"},{\"properties\":{\"createdTime\":\"2021-02-11T01:14:35Z\",\"lastModifiedTime\":\"2021-02-21T18:42:47Z\",\"sizeInKb\":817515704706875655,\"type\":\"ayqigynduhav\",\"url\":\"lkthu\"},\"id\":\"qolbgyc\",\"name\":\"uie\",\"type\":\"tgccymvaolpss\"}],\"nextLink\":\"lfmmdnbbglzpswi\"}")
                .toObject(LogFileListResult.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-30T19:00:32Z"), model.value().get(0).createdTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-25T00:29:47Z"), model.value().get(0).lastModifiedTime());
        Assertions.assertEquals(404870877224643205L, model.value().get(0).sizeInKb());
        Assertions.assertEquals("sqfsubcgjbirxb", model.value().get(0).typePropertiesType());
        Assertions.assertEquals("bsrfbj", model.value().get(0).url());
        Assertions.assertEquals("lfmmdnbbglzpswi", model.nextLink());
    }

    @org.junit.jupiter.api.Test
    public void testSerialize() throws Exception {
        LogFileListResult model =
            new LogFileListResult()
                .withValue(
                    Arrays
                        .asList(
                            new LogFileInner()
                                .withCreatedTime(OffsetDateTime.parse("2021-08-30T19:00:32Z"))
                                .withLastModifiedTime(OffsetDateTime.parse("2021-03-25T00:29:47Z"))
                                .withSizeInKb(404870877224643205L)
                                .withTypePropertiesType("sqfsubcgjbirxb")
                                .withUrl("bsrfbj"),
                            new LogFileInner()
                                .withCreatedTime(OffsetDateTime.parse("2021-08-29T16:58:02Z"))
                                .withLastModifiedTime(OffsetDateTime.parse("2021-09-17T08:06:16Z"))
                                .withSizeInKb(7676995030931016800L)
                                .withTypePropertiesType("oujmkcjhwqytj")
                                .withUrl("bnw"),
                            new LogFileInner()
                                .withCreatedTime(OffsetDateTime.parse("2021-02-11T01:14:35Z"))
                                .withLastModifiedTime(OffsetDateTime.parse("2021-02-21T18:42:47Z"))
                                .withSizeInKb(817515704706875655L)
                                .withTypePropertiesType("ayqigynduhav")
                                .withUrl("lkthu")))
                .withNextLink("lfmmdnbbglzpswi");
        model = BinaryData.fromObject(model).toObject(LogFileListResult.class);
        Assertions.assertEquals(OffsetDateTime.parse("2021-08-30T19:00:32Z"), model.value().get(0).createdTime());
        Assertions.assertEquals(OffsetDateTime.parse("2021-03-25T00:29:47Z"), model.value().get(0).lastModifiedTime());
        Assertions.assertEquals(404870877224643205L, model.value().get(0).sizeInKb());
        Assertions.assertEquals("sqfsubcgjbirxb", model.value().get(0).typePropertiesType());
        Assertions.assertEquals("bsrfbj", model.value().get(0).url());
        Assertions.assertEquals("lfmmdnbbglzpswi", model.nextLink());
    }
}
