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

package com.azure.resourcemanager.orbital.implementation;

import com.azure.core.management.SystemData;
import com.azure.core.util.Context;
import com.azure.resourcemanager.orbital.fluent.models.ContactInner;
import com.azure.resourcemanager.orbital.models.Contact;
import com.azure.resourcemanager.orbital.models.ContactsPropertiesAntennaConfiguration;
import com.azure.resourcemanager.orbital.models.ContactsPropertiesContactProfile;
import com.azure.resourcemanager.orbital.models.ContactsPropertiesProvisioningState;
import com.azure.resourcemanager.orbital.models.ContactsStatus;
import java.time.OffsetDateTime;

public final class ContactImpl implements Contact, Contact.Definition {
    private ContactInner innerObject;

    private final com.azure.resourcemanager.orbital.OrbitalManager serviceManager;

    ContactImpl(ContactInner innerObject, com.azure.resourcemanager.orbital.OrbitalManager serviceManager) {
        this.innerObject = innerObject;
        this.serviceManager = serviceManager;
    }

    public String id() {
        return this.innerModel().id();
    }

    public String name() {
        return this.innerModel().name();
    }

    public String type() {
        return this.innerModel().type();
    }

    public SystemData systemData() {
        return this.innerModel().systemData();
    }

    public ContactsPropertiesProvisioningState provisioningState() {
        return this.innerModel().provisioningState();
    }

    public ContactsStatus status() {
        return this.innerModel().status();
    }

    public OffsetDateTime reservationStartTime() {
        return this.innerModel().reservationStartTime();
    }

    public OffsetDateTime reservationEndTime() {
        return this.innerModel().reservationEndTime();
    }

    public OffsetDateTime rxStartTime() {
        return this.innerModel().rxStartTime();
    }

    public OffsetDateTime rxEndTime() {
        return this.innerModel().rxEndTime();
    }

    public OffsetDateTime txStartTime() {
        return this.innerModel().txStartTime();
    }

    public OffsetDateTime txEndTime() {
        return this.innerModel().txEndTime();
    }

    public String errorMessage() {
        return this.innerModel().errorMessage();
    }

    public Float maximumElevationDegrees() {
        return this.innerModel().maximumElevationDegrees();
    }

    public Float startAzimuthDegrees() {
        return this.innerModel().startAzimuthDegrees();
    }

    public Float endAzimuthDegrees() {
        return this.innerModel().endAzimuthDegrees();
    }

    public String groundStationName() {
        return this.innerModel().groundStationName();
    }

    public Float startElevationDegrees() {
        return this.innerModel().startElevationDegrees();
    }

    public Float endElevationDegrees() {
        return this.innerModel().endElevationDegrees();
    }

    public ContactsPropertiesAntennaConfiguration antennaConfiguration() {
        return this.innerModel().antennaConfiguration();
    }

    public ContactsPropertiesContactProfile contactProfile() {
        return this.innerModel().contactProfile();
    }

    public ContactInner innerModel() {
        return this.innerObject;
    }

    private com.azure.resourcemanager.orbital.OrbitalManager manager() {
        return this.serviceManager;
    }

    private String resourceGroupName;

    private String spacecraftName;

    private String contactName;

    public ContactImpl withExistingSpacecraft(String resourceGroupName, String spacecraftName) {
        this.resourceGroupName = resourceGroupName;
        this.spacecraftName = spacecraftName;
        return this;
    }

    public Contact create() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getContacts()
                .create(resourceGroupName, spacecraftName, contactName, this.innerModel(), Context.NONE);
        return this;
    }

    public Contact create(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getContacts()
                .create(resourceGroupName, spacecraftName, contactName, this.innerModel(), context);
        return this;
    }

    ContactImpl(String name, com.azure.resourcemanager.orbital.OrbitalManager serviceManager) {
        this.innerObject = new ContactInner();
        this.serviceManager = serviceManager;
        this.contactName = name;
    }

    public Contact refresh() {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getContacts()
                .getWithResponse(resourceGroupName, spacecraftName, contactName, Context.NONE)
                .getValue();
        return this;
    }

    public Contact refresh(Context context) {
        this.innerObject =
            serviceManager
                .serviceClient()
                .getContacts()
                .getWithResponse(resourceGroupName, spacecraftName, contactName, context)
                .getValue();
        return this;
    }

    public ContactImpl withReservationStartTime(OffsetDateTime reservationStartTime) {
        this.innerModel().withReservationStartTime(reservationStartTime);
        return this;
    }

    public ContactImpl withReservationEndTime(OffsetDateTime reservationEndTime) {
        this.innerModel().withReservationEndTime(reservationEndTime);
        return this;
    }

    public ContactImpl withGroundStationName(String groundStationName) {
        this.innerModel().withGroundStationName(groundStationName);
        return this;
    }

    public ContactImpl withContactProfile(ContactsPropertiesContactProfile contactProfile) {
        this.innerModel().withContactProfile(contactProfile);
        return this;
    }

    public ContactImpl withProvisioningState(ContactsPropertiesProvisioningState provisioningState) {
        this.innerModel().withProvisioningState(provisioningState);
        return this;
    }
}
