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

package com.azure.resourcemanager.devhub.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.devhub.models.Acr;
import com.azure.resourcemanager.devhub.models.AuthorizationStatus;
import com.azure.resourcemanager.devhub.models.DeploymentProperties;
import com.azure.resourcemanager.devhub.models.GitHubWorkflowProfileOidcCredentials;
import com.azure.resourcemanager.devhub.models.PullRequestStatus;
import com.azure.resourcemanager.devhub.models.WorkflowRun;
import com.fasterxml.jackson.annotation.JsonProperty;

/** GitHub Workflow Profile. */
@Fluent
public final class GitHubWorkflowProfile {
    /*
     * The owner of the repository the workflow is associated with.
     *
     * Repository Owner
     */
    @JsonProperty(value = "repositoryOwner")
    private String repositoryOwner;

    /*
     * The name of the repository the workflow is associated with.
     *
     * Repository Name
     */
    @JsonProperty(value = "repositoryName")
    private String repositoryName;

    /*
     * The name of the branch the workflow is associated with.
     *
     * Repository Branch Name
     */
    @JsonProperty(value = "branchName")
    private String branchName;

    /*
     * Path to Dockerfile within the repository.
     *
     * Path to the Dockerfile within the repository.
     */
    @JsonProperty(value = "dockerfile")
    private String dockerfile;

    /*
     * Path to Dockerfile Build Context within the repository.
     */
    @JsonProperty(value = "dockerBuildContext")
    private String dockerBuildContext;

    /*
     * The deploymentProperties property.
     */
    @JsonProperty(value = "deploymentProperties")
    private DeploymentProperties deploymentProperties;

    /*
     * The Kubernetes namespace the application is deployed to
     *
     * Kubernetes namespace the application is deployed to.
     */
    @JsonProperty(value = "namespace")
    private String namespace;

    /*
     * Information on the azure container registry
     */
    @JsonProperty(value = "acr")
    private Acr acr;

    /*
     * The fields needed for OIDC with GitHub.
     */
    @JsonProperty(value = "oidcCredentials")
    private GitHubWorkflowProfileOidcCredentials oidcCredentials;

    /*
     * The Azure Kubernetes Managed Cluster resource.
     *
     * The Azure Kubernetes Cluster Resource the application will be deployed to.
     */
    @JsonProperty(value = "aksResourceId")
    private String aksResourceId;

    /*
     * The URL to the Pull Request submitted against the users repository.
     */
    @JsonProperty(value = "prURL", access = JsonProperty.Access.WRITE_ONLY)
    private String prUrl;

    /*
     * The number associated with the submitted pull request.
     */
    @JsonProperty(value = "pullNumber", access = JsonProperty.Access.WRITE_ONLY)
    private Integer pullNumber;

    /*
     * The status of the Pull Request submitted against the users repository.
     */
    @JsonProperty(value = "prStatus", access = JsonProperty.Access.WRITE_ONLY)
    private PullRequestStatus prStatus;

    /*
     * The lastWorkflowRun property.
     */
    @JsonProperty(value = "lastWorkflowRun")
    private WorkflowRun lastWorkflowRun;

    /*
     * Determines the authorization status of requests.
     */
    @JsonProperty(value = "authStatus", access = JsonProperty.Access.WRITE_ONLY)
    private AuthorizationStatus authStatus;

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

    /**
     * Get the repositoryOwner property: The owner of the repository the workflow is associated with.
     *
     * <p>Repository Owner.
     *
     * @return the repositoryOwner value.
     */
    public String repositoryOwner() {
        return this.repositoryOwner;
    }

    /**
     * Set the repositoryOwner property: The owner of the repository the workflow is associated with.
     *
     * <p>Repository Owner.
     *
     * @param repositoryOwner the repositoryOwner value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withRepositoryOwner(String repositoryOwner) {
        this.repositoryOwner = repositoryOwner;
        return this;
    }

    /**
     * Get the repositoryName property: The name of the repository the workflow is associated with.
     *
     * <p>Repository Name.
     *
     * @return the repositoryName value.
     */
    public String repositoryName() {
        return this.repositoryName;
    }

    /**
     * Set the repositoryName property: The name of the repository the workflow is associated with.
     *
     * <p>Repository Name.
     *
     * @param repositoryName the repositoryName value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withRepositoryName(String repositoryName) {
        this.repositoryName = repositoryName;
        return this;
    }

    /**
     * Get the branchName property: The name of the branch the workflow is associated with.
     *
     * <p>Repository Branch Name.
     *
     * @return the branchName value.
     */
    public String branchName() {
        return this.branchName;
    }

    /**
     * Set the branchName property: The name of the branch the workflow is associated with.
     *
     * <p>Repository Branch Name.
     *
     * @param branchName the branchName value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withBranchName(String branchName) {
        this.branchName = branchName;
        return this;
    }

    /**
     * Get the dockerfile property: Path to Dockerfile within the repository.
     *
     * <p>Path to the Dockerfile within the repository.
     *
     * @return the dockerfile value.
     */
    public String dockerfile() {
        return this.dockerfile;
    }

    /**
     * Set the dockerfile property: Path to Dockerfile within the repository.
     *
     * <p>Path to the Dockerfile within the repository.
     *
     * @param dockerfile the dockerfile value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withDockerfile(String dockerfile) {
        this.dockerfile = dockerfile;
        return this;
    }

    /**
     * Get the dockerBuildContext property: Path to Dockerfile Build Context within the repository.
     *
     * @return the dockerBuildContext value.
     */
    public String dockerBuildContext() {
        return this.dockerBuildContext;
    }

    /**
     * Set the dockerBuildContext property: Path to Dockerfile Build Context within the repository.
     *
     * @param dockerBuildContext the dockerBuildContext value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withDockerBuildContext(String dockerBuildContext) {
        this.dockerBuildContext = dockerBuildContext;
        return this;
    }

    /**
     * Get the deploymentProperties property: The deploymentProperties property.
     *
     * @return the deploymentProperties value.
     */
    public DeploymentProperties deploymentProperties() {
        return this.deploymentProperties;
    }

    /**
     * Set the deploymentProperties property: The deploymentProperties property.
     *
     * @param deploymentProperties the deploymentProperties value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withDeploymentProperties(DeploymentProperties deploymentProperties) {
        this.deploymentProperties = deploymentProperties;
        return this;
    }

    /**
     * Get the namespace property: The Kubernetes namespace the application is deployed to
     *
     * <p>Kubernetes namespace the application is deployed to.
     *
     * @return the namespace value.
     */
    public String namespace() {
        return this.namespace;
    }

    /**
     * Set the namespace property: The Kubernetes namespace the application is deployed to
     *
     * <p>Kubernetes namespace the application is deployed to.
     *
     * @param namespace the namespace value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withNamespace(String namespace) {
        this.namespace = namespace;
        return this;
    }

    /**
     * Get the acr property: Information on the azure container registry.
     *
     * @return the acr value.
     */
    public Acr acr() {
        return this.acr;
    }

    /**
     * Set the acr property: Information on the azure container registry.
     *
     * @param acr the acr value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withAcr(Acr acr) {
        this.acr = acr;
        return this;
    }

    /**
     * Get the oidcCredentials property: The fields needed for OIDC with GitHub.
     *
     * @return the oidcCredentials value.
     */
    public GitHubWorkflowProfileOidcCredentials oidcCredentials() {
        return this.oidcCredentials;
    }

    /**
     * Set the oidcCredentials property: The fields needed for OIDC with GitHub.
     *
     * @param oidcCredentials the oidcCredentials value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withOidcCredentials(GitHubWorkflowProfileOidcCredentials oidcCredentials) {
        this.oidcCredentials = oidcCredentials;
        return this;
    }

    /**
     * Get the aksResourceId property: The Azure Kubernetes Managed Cluster resource.
     *
     * <p>The Azure Kubernetes Cluster Resource the application will be deployed to.
     *
     * @return the aksResourceId value.
     */
    public String aksResourceId() {
        return this.aksResourceId;
    }

    /**
     * Set the aksResourceId property: The Azure Kubernetes Managed Cluster resource.
     *
     * <p>The Azure Kubernetes Cluster Resource the application will be deployed to.
     *
     * @param aksResourceId the aksResourceId value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withAksResourceId(String aksResourceId) {
        this.aksResourceId = aksResourceId;
        return this;
    }

    /**
     * Get the prUrl property: The URL to the Pull Request submitted against the users repository.
     *
     * @return the prUrl value.
     */
    public String prUrl() {
        return this.prUrl;
    }

    /**
     * Get the pullNumber property: The number associated with the submitted pull request.
     *
     * @return the pullNumber value.
     */
    public Integer pullNumber() {
        return this.pullNumber;
    }

    /**
     * Get the prStatus property: The status of the Pull Request submitted against the users repository.
     *
     * @return the prStatus value.
     */
    public PullRequestStatus prStatus() {
        return this.prStatus;
    }

    /**
     * Get the lastWorkflowRun property: The lastWorkflowRun property.
     *
     * @return the lastWorkflowRun value.
     */
    public WorkflowRun lastWorkflowRun() {
        return this.lastWorkflowRun;
    }

    /**
     * Set the lastWorkflowRun property: The lastWorkflowRun property.
     *
     * @param lastWorkflowRun the lastWorkflowRun value to set.
     * @return the GitHubWorkflowProfile object itself.
     */
    public GitHubWorkflowProfile withLastWorkflowRun(WorkflowRun lastWorkflowRun) {
        this.lastWorkflowRun = lastWorkflowRun;
        return this;
    }

    /**
     * Get the authStatus property: Determines the authorization status of requests.
     *
     * @return the authStatus value.
     */
    public AuthorizationStatus authStatus() {
        return this.authStatus;
    }

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