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

package com.azure.resourcemanager.appcomplianceautomation.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.time.OffsetDateTime;
import java.util.List;

/** Report's properties. */
@Fluent
public final class ReportProperties {
    /*
     * Report id in database.
     */
    @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY)
    private String id;

    /*
     * Report status.
     */
    @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY)
    private ReportStatus status;

    /*
     * Report's tenant id.
     */
    @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY)
    private String tenantId;

    /*
     * Report name.
     */
    @JsonProperty(value = "reportName", access = JsonProperty.Access.WRITE_ONLY)
    private String reportName;

    /*
     * Report offer Guid.
     */
    @JsonProperty(value = "offerGuid")
    private String offerGuid;

    /*
     * Report collection trigger time's time zone, the available list can be obtained by executing "Get-TimeZone
     * -ListAvailable" in PowerShell.
     * An example of valid timezone id is "Pacific Standard Time".
     */
    @JsonProperty(value = "timeZone", required = true)
    private String timeZone;

    /*
     * Report collection trigger time.
     */
    @JsonProperty(value = "triggerTime", required = true)
    private OffsetDateTime triggerTime;

    /*
     * Report next collection trigger time.
     */
    @JsonProperty(value = "nextTriggerTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime nextTriggerTime;

    /*
     * Report last collection trigger time.
     */
    @JsonProperty(value = "lastTriggerTime", access = JsonProperty.Access.WRITE_ONLY)
    private OffsetDateTime lastTriggerTime;

    /*
     * List of subscription Ids.
     */
    @JsonProperty(value = "subscriptions", access = JsonProperty.Access.WRITE_ONLY)
    private List<String> subscriptions;

    /*
     * List of resource data.
     */
    @JsonProperty(value = "resources", required = true)
    private List<ResourceMetadata> resources;

    /*
     * Report compliance status.
     */
    @JsonProperty(value = "complianceStatus", access = JsonProperty.Access.WRITE_ONLY)
    private ReportComplianceStatus complianceStatus;

    /*
     * Azure lifecycle management
     */
    @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
    private ProvisioningState provisioningState;

    /** Creates an instance of ReportProperties class. */
    public ReportProperties() {
    }

    /**
     * Get the id property: Report id in database.
     *
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the status property: Report status.
     *
     * @return the status value.
     */
    public ReportStatus status() {
        return this.status;
    }

    /**
     * Get the tenantId property: Report's tenant id.
     *
     * @return the tenantId value.
     */
    public String tenantId() {
        return this.tenantId;
    }

    /**
     * Get the reportName property: Report name.
     *
     * @return the reportName value.
     */
    public String reportName() {
        return this.reportName;
    }

    /**
     * Get the offerGuid property: Report offer Guid.
     *
     * @return the offerGuid value.
     */
    public String offerGuid() {
        return this.offerGuid;
    }

    /**
     * Set the offerGuid property: Report offer Guid.
     *
     * @param offerGuid the offerGuid value to set.
     * @return the ReportProperties object itself.
     */
    public ReportProperties withOfferGuid(String offerGuid) {
        this.offerGuid = offerGuid;
        return this;
    }

    /**
     * Get the timeZone property: Report collection trigger time's time zone, the available list can be obtained by
     * executing "Get-TimeZone -ListAvailable" in PowerShell. An example of valid timezone id is "Pacific Standard
     * Time".
     *
     * @return the timeZone value.
     */
    public String timeZone() {
        return this.timeZone;
    }

    /**
     * Set the timeZone property: Report collection trigger time's time zone, the available list can be obtained by
     * executing "Get-TimeZone -ListAvailable" in PowerShell. An example of valid timezone id is "Pacific Standard
     * Time".
     *
     * @param timeZone the timeZone value to set.
     * @return the ReportProperties object itself.
     */
    public ReportProperties withTimeZone(String timeZone) {
        this.timeZone = timeZone;
        return this;
    }

    /**
     * Get the triggerTime property: Report collection trigger time.
     *
     * @return the triggerTime value.
     */
    public OffsetDateTime triggerTime() {
        return this.triggerTime;
    }

    /**
     * Set the triggerTime property: Report collection trigger time.
     *
     * @param triggerTime the triggerTime value to set.
     * @return the ReportProperties object itself.
     */
    public ReportProperties withTriggerTime(OffsetDateTime triggerTime) {
        this.triggerTime = triggerTime;
        return this;
    }

    /**
     * Get the nextTriggerTime property: Report next collection trigger time.
     *
     * @return the nextTriggerTime value.
     */
    public OffsetDateTime nextTriggerTime() {
        return this.nextTriggerTime;
    }

    /**
     * Get the lastTriggerTime property: Report last collection trigger time.
     *
     * @return the lastTriggerTime value.
     */
    public OffsetDateTime lastTriggerTime() {
        return this.lastTriggerTime;
    }

    /**
     * Get the subscriptions property: List of subscription Ids.
     *
     * @return the subscriptions value.
     */
    public List<String> subscriptions() {
        return this.subscriptions;
    }

    /**
     * Get the resources property: List of resource data.
     *
     * @return the resources value.
     */
    public List<ResourceMetadata> resources() {
        return this.resources;
    }

    /**
     * Set the resources property: List of resource data.
     *
     * @param resources the resources value to set.
     * @return the ReportProperties object itself.
     */
    public ReportProperties withResources(List<ResourceMetadata> resources) {
        this.resources = resources;
        return this;
    }

    /**
     * Get the complianceStatus property: Report compliance status.
     *
     * @return the complianceStatus value.
     */
    public ReportComplianceStatus complianceStatus() {
        return this.complianceStatus;
    }

    /**
     * Get the provisioningState property: Azure lifecycle management.
     *
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (timeZone() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property timeZone in model ReportProperties"));
        }
        if (triggerTime() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property triggerTime in model ReportProperties"));
        }
        if (resources() == null) {
            throw LOGGER
                .logExceptionAsError(
                    new IllegalArgumentException("Missing required property resources in model ReportProperties"));
        } else {
            resources().forEach(e -> e.validate());
        }
        if (complianceStatus() != null) {
            complianceStatus().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(ReportProperties.class);
}
