// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.gcp.bigquery.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.bigquery.outputs.JobCopyDestinationEncryptionConfiguration;
import com.pulumi.gcp.bigquery.outputs.JobCopyDestinationTable;
import com.pulumi.gcp.bigquery.outputs.JobCopySourceTable;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class JobCopy {
    /**
     * @return Specifies whether the job is allowed to create new tables. The following values are supported:
     * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table.
     * CREATE_NEVER: The table must already exist. If it does not, a &#39;notFound&#39; error is returned in the job result.
     * Creation, truncation and append actions occur as one atomic update upon job completion
     * Default value is `CREATE_IF_NEEDED`.
     * Possible values are: `CREATE_IF_NEEDED`, `CREATE_NEVER`.
     * 
     */
    private @Nullable String createDisposition;
    /**
     * @return Custom encryption configuration (e.g., Cloud KMS keys)
     * Structure is documented below.
     * 
     */
    private @Nullable JobCopyDestinationEncryptionConfiguration destinationEncryptionConfiguration;
    /**
     * @return The destination table.
     * Structure is documented below.
     * 
     */
    private @Nullable JobCopyDestinationTable destinationTable;
    /**
     * @return Source tables to copy.
     * Structure is documented below.
     * 
     */
    private List<JobCopySourceTable> sourceTables;
    /**
     * @return Specifies the action that occurs if the destination table already exists. The following values are supported:
     * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data and uses the schema from the query result.
     * WRITE_APPEND: If the table already exists, BigQuery appends the data to the table.
     * WRITE_EMPTY: If the table already exists and contains data, a &#39;duplicate&#39; error is returned in the job result.
     * Each action is atomic and only occurs if BigQuery is able to complete the job successfully.
     * Creation, truncation and append actions occur as one atomic update upon job completion.
     * Default value is `WRITE_EMPTY`.
     * Possible values are: `WRITE_TRUNCATE`, `WRITE_APPEND`, `WRITE_EMPTY`.
     * 
     */
    private @Nullable String writeDisposition;

    private JobCopy() {}
    /**
     * @return Specifies whether the job is allowed to create new tables. The following values are supported:
     * CREATE_IF_NEEDED: If the table does not exist, BigQuery creates the table.
     * CREATE_NEVER: The table must already exist. If it does not, a &#39;notFound&#39; error is returned in the job result.
     * Creation, truncation and append actions occur as one atomic update upon job completion
     * Default value is `CREATE_IF_NEEDED`.
     * Possible values are: `CREATE_IF_NEEDED`, `CREATE_NEVER`.
     * 
     */
    public Optional<String> createDisposition() {
        return Optional.ofNullable(this.createDisposition);
    }
    /**
     * @return Custom encryption configuration (e.g., Cloud KMS keys)
     * Structure is documented below.
     * 
     */
    public Optional<JobCopyDestinationEncryptionConfiguration> destinationEncryptionConfiguration() {
        return Optional.ofNullable(this.destinationEncryptionConfiguration);
    }
    /**
     * @return The destination table.
     * Structure is documented below.
     * 
     */
    public Optional<JobCopyDestinationTable> destinationTable() {
        return Optional.ofNullable(this.destinationTable);
    }
    /**
     * @return Source tables to copy.
     * Structure is documented below.
     * 
     */
    public List<JobCopySourceTable> sourceTables() {
        return this.sourceTables;
    }
    /**
     * @return Specifies the action that occurs if the destination table already exists. The following values are supported:
     * WRITE_TRUNCATE: If the table already exists, BigQuery overwrites the table data and uses the schema from the query result.
     * WRITE_APPEND: If the table already exists, BigQuery appends the data to the table.
     * WRITE_EMPTY: If the table already exists and contains data, a &#39;duplicate&#39; error is returned in the job result.
     * Each action is atomic and only occurs if BigQuery is able to complete the job successfully.
     * Creation, truncation and append actions occur as one atomic update upon job completion.
     * Default value is `WRITE_EMPTY`.
     * Possible values are: `WRITE_TRUNCATE`, `WRITE_APPEND`, `WRITE_EMPTY`.
     * 
     */
    public Optional<String> writeDisposition() {
        return Optional.ofNullable(this.writeDisposition);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(JobCopy defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable String createDisposition;
        private @Nullable JobCopyDestinationEncryptionConfiguration destinationEncryptionConfiguration;
        private @Nullable JobCopyDestinationTable destinationTable;
        private List<JobCopySourceTable> sourceTables;
        private @Nullable String writeDisposition;
        public Builder() {}
        public Builder(JobCopy defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.createDisposition = defaults.createDisposition;
    	      this.destinationEncryptionConfiguration = defaults.destinationEncryptionConfiguration;
    	      this.destinationTable = defaults.destinationTable;
    	      this.sourceTables = defaults.sourceTables;
    	      this.writeDisposition = defaults.writeDisposition;
        }

        @CustomType.Setter
        public Builder createDisposition(@Nullable String createDisposition) {
            this.createDisposition = createDisposition;
            return this;
        }
        @CustomType.Setter
        public Builder destinationEncryptionConfiguration(@Nullable JobCopyDestinationEncryptionConfiguration destinationEncryptionConfiguration) {
            this.destinationEncryptionConfiguration = destinationEncryptionConfiguration;
            return this;
        }
        @CustomType.Setter
        public Builder destinationTable(@Nullable JobCopyDestinationTable destinationTable) {
            this.destinationTable = destinationTable;
            return this;
        }
        @CustomType.Setter
        public Builder sourceTables(List<JobCopySourceTable> sourceTables) {
            this.sourceTables = Objects.requireNonNull(sourceTables);
            return this;
        }
        public Builder sourceTables(JobCopySourceTable... sourceTables) {
            return sourceTables(List.of(sourceTables));
        }
        @CustomType.Setter
        public Builder writeDisposition(@Nullable String writeDisposition) {
            this.writeDisposition = writeDisposition;
            return this;
        }
        public JobCopy build() {
            final var o = new JobCopy();
            o.createDisposition = createDisposition;
            o.destinationEncryptionConfiguration = destinationEncryptionConfiguration;
            o.destinationTable = destinationTable;
            o.sourceTables = sourceTables;
            o.writeDisposition = writeDisposition;
            return o;
        }
    }
}
