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

package com.azure.resourcemanager.kubernetesconfiguration.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** Parameters to reconcile to the GitRepository source kind type. */
@Fluent
public final class GitRepositoryPatchDefinition {
    /*
     * The URL to sync for the flux configuration git repository.
     */
    @JsonProperty(value = "url")
    private String url;

    /*
     * The maximum time to attempt to reconcile the cluster git repository source with the remote.
     */
    @JsonProperty(value = "timeoutInSeconds")
    private Long timeoutInSeconds;

    /*
     * The interval at which to re-reconcile the cluster git repository source with the remote.
     */
    @JsonProperty(value = "syncIntervalInSeconds")
    private Long syncIntervalInSeconds;

    /*
     * The source reference for the GitRepository object.
     */
    @JsonProperty(value = "repositoryRef")
    private RepositoryRefDefinition repositoryRef;

    /*
     * Base64-encoded known_hosts value containing public SSH keys required to access private git repositories over SSH
     */
    @JsonProperty(value = "sshKnownHosts")
    private String sshKnownHosts;

    /*
     * Plaintext HTTPS username used to access private git repositories over HTTPS
     */
    @JsonProperty(value = "httpsUser")
    private String httpsUser;

    /*
     * Base64-encoded HTTPS certificate authority contents used to access git private git repositories over HTTPS
     */
    @JsonProperty(value = "httpsCACert")
    private String httpsCACert;

    /*
     * Name of a local secret on the Kubernetes cluster to use as the authentication secret rather than the managed or
     * user-provided configuration secrets.
     */
    @JsonProperty(value = "localAuthRef")
    private String localAuthRef;

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

    /**
     * Get the url property: The URL to sync for the flux configuration git repository.
     *
     * @return the url value.
     */
    public String url() {
        return this.url;
    }

    /**
     * Set the url property: The URL to sync for the flux configuration git repository.
     *
     * @param url the url value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withUrl(String url) {
        this.url = url;
        return this;
    }

    /**
     * Get the timeoutInSeconds property: The maximum time to attempt to reconcile the cluster git repository source
     * with the remote.
     *
     * @return the timeoutInSeconds value.
     */
    public Long timeoutInSeconds() {
        return this.timeoutInSeconds;
    }

    /**
     * Set the timeoutInSeconds property: The maximum time to attempt to reconcile the cluster git repository source
     * with the remote.
     *
     * @param timeoutInSeconds the timeoutInSeconds value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withTimeoutInSeconds(Long timeoutInSeconds) {
        this.timeoutInSeconds = timeoutInSeconds;
        return this;
    }

    /**
     * Get the syncIntervalInSeconds property: The interval at which to re-reconcile the cluster git repository source
     * with the remote.
     *
     * @return the syncIntervalInSeconds value.
     */
    public Long syncIntervalInSeconds() {
        return this.syncIntervalInSeconds;
    }

    /**
     * Set the syncIntervalInSeconds property: The interval at which to re-reconcile the cluster git repository source
     * with the remote.
     *
     * @param syncIntervalInSeconds the syncIntervalInSeconds value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withSyncIntervalInSeconds(Long syncIntervalInSeconds) {
        this.syncIntervalInSeconds = syncIntervalInSeconds;
        return this;
    }

    /**
     * Get the repositoryRef property: The source reference for the GitRepository object.
     *
     * @return the repositoryRef value.
     */
    public RepositoryRefDefinition repositoryRef() {
        return this.repositoryRef;
    }

    /**
     * Set the repositoryRef property: The source reference for the GitRepository object.
     *
     * @param repositoryRef the repositoryRef value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withRepositoryRef(RepositoryRefDefinition repositoryRef) {
        this.repositoryRef = repositoryRef;
        return this;
    }

    /**
     * Get the sshKnownHosts property: Base64-encoded known_hosts value containing public SSH keys required to access
     * private git repositories over SSH.
     *
     * @return the sshKnownHosts value.
     */
    public String sshKnownHosts() {
        return this.sshKnownHosts;
    }

    /**
     * Set the sshKnownHosts property: Base64-encoded known_hosts value containing public SSH keys required to access
     * private git repositories over SSH.
     *
     * @param sshKnownHosts the sshKnownHosts value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withSshKnownHosts(String sshKnownHosts) {
        this.sshKnownHosts = sshKnownHosts;
        return this;
    }

    /**
     * Get the httpsUser property: Plaintext HTTPS username used to access private git repositories over HTTPS.
     *
     * @return the httpsUser value.
     */
    public String httpsUser() {
        return this.httpsUser;
    }

    /**
     * Set the httpsUser property: Plaintext HTTPS username used to access private git repositories over HTTPS.
     *
     * @param httpsUser the httpsUser value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withHttpsUser(String httpsUser) {
        this.httpsUser = httpsUser;
        return this;
    }

    /**
     * Get the httpsCACert property: Base64-encoded HTTPS certificate authority contents used to access git private git
     * repositories over HTTPS.
     *
     * @return the httpsCACert value.
     */
    public String httpsCACert() {
        return this.httpsCACert;
    }

    /**
     * Set the httpsCACert property: Base64-encoded HTTPS certificate authority contents used to access git private git
     * repositories over HTTPS.
     *
     * @param httpsCACert the httpsCACert value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withHttpsCACert(String httpsCACert) {
        this.httpsCACert = httpsCACert;
        return this;
    }

    /**
     * Get the localAuthRef property: Name of a local secret on the Kubernetes cluster to use as the authentication
     * secret rather than the managed or user-provided configuration secrets.
     *
     * @return the localAuthRef value.
     */
    public String localAuthRef() {
        return this.localAuthRef;
    }

    /**
     * Set the localAuthRef property: Name of a local secret on the Kubernetes cluster to use as the authentication
     * secret rather than the managed or user-provided configuration secrets.
     *
     * @param localAuthRef the localAuthRef value to set.
     * @return the GitRepositoryPatchDefinition object itself.
     */
    public GitRepositoryPatchDefinition withLocalAuthRef(String localAuthRef) {
        this.localAuthRef = localAuthRef;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (repositoryRef() != null) {
            repositoryRef().validate();
        }
    }
}
