// Path: src/main/java/com/verifalia/api/emailvalidations/serialization/LineEndingModeSerializer.java
// public class LineEndingModeSerializer extends JsonSerializer<LineEndingMode> {
//     @Override
//     public void serialize(LineEndingMode value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
//         if (value == null || value == LineEndingMode.Auto) {
//             jgen.writeNull();
//         } else {
//             jgen.writeString(value.toString());
//         }
//     }
// }


import com.verifalia.api.emailvalidations.serialization.LineEndingModeSerializer;
import lombok.*;
import org.apache.http.entity.ContentType;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import java.io.*;
import static java.util.Objects.nonNull;
/*
 * Verifalia - Email list cleaning and real-time email verification service
 * https://verifalia.com/
 * support@verifalia.com
 *
 * Copyright (c) 2005-2020 Cobisi Research
 *
 * Cobisi Research
 * Via Prima Strada, 35
 * 35129, Padova
 * Italy - European Union
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.verifalia.api.emailvalidations.models;




/**
 * Represents an email validation request through a file import, to be submitted against the Verifalia API.
 * Verifalia offers support for the following file types:
 * - plain text files (.txt), with one email address per line (MIME type: text/plain)
 * - comma-separated values (.csv), tab-separated values (.tsv) and other delimiter-separated values files (MIME
 * types: text/csv and text/tab-separated-values)
 * - Microsoft Excel spreadsheets - .xls and .xlsx - (MIME types: application/vnd.ms-excel and
 * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet).
 */
@Getter
@Setter
@ToString
@AllArgsConstructor
@Builder
public class FileValidationRequest extends AbstractValidationRequest {
    /**
     * An {@link InputStream} (a {@link java.io.FileInputStream}, for example) containing the email addresses to validate.
     */
    @NonNull
    @JsonIgnore
    private InputStream inputStream;

    /**
     * The {@link ContentType} of the provided input file.
     */
    @NonNull
    @JsonIgnore
    private ContentType contentType;

    /**
     * An optional {@link Integer} with the zero-based index of the first row to import and process. If not specified, Verifalia
     * will start processing files from the first (0) row.
     */
    private Integer startingRow;

    /**
     * An optional {@link Integer} with the zero-based index of the last row to import and process. If not specified, Verifalia
     * will process rows until the end of the file.
     */
    private Integer endingRow;

    /**
     * An optional {@link Integer} with the zero-based index of the column to import; applies to comma-separated (.csv),
     * tab-separated (.tsv) and other delimiter-separated values files, and Excel files. If not specified, Verifalia will
     * use the first (0) column.
     */
    private Integer column;

    /**
     * An optional {@link Integer} with the zero-based index of the worksheet to import; applies to Excel files only.
     * If not specified, Verifalia will use the first (0) worksheet.
     */
    private Integer sheet;

    /**
     * Allows to specify the line ending sequence of the provided file; applies to plain-text files, comma-separated (.csv),
     * tab-separated (.tsv) and other delimiter-separated values files.
     */
// Path: src/main/java/com/verifalia/api/emailvalidations/serialization/LineEndingModeSerializer.java
// public class LineEndingModeSerializer extends JsonSerializer<LineEndingMode> {
//     @Override
//     public void serialize(LineEndingMode value, JsonGenerator jgen, SerializerProvider provider) throws IOException {
//         if (value == null || value == LineEndingMode.Auto) {
//             jgen.writeNull();
//         } else {
//             jgen.writeString(value.toString());
//         }
//     }
// }


// Path: src/main/java/com/verifalia/api/emailvalidations/models/FileValidationRequest.java
import com.verifalia.api.emailvalidations.serialization.LineEndingModeSerializer;
import lombok.*;
import org.apache.http.entity.ContentType;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.map.annotate.JsonSerialize;
import java.io.*;
import static java.util.Objects.nonNull;

/*
 * Verifalia - Email list cleaning and real-time email verification service
 * https://verifalia.com/
 * support@verifalia.com
 *
 * Copyright (c) 2005-2020 Cobisi Research
 *
 * Cobisi Research
 * Via Prima Strada, 35
 * 35129, Padova
 * Italy - European Union
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.verifalia.api.emailvalidations.models;




/**
 * Represents an email validation request through a file import, to be submitted against the Verifalia API.
 * Verifalia offers support for the following file types:
 * - plain text files (.txt), with one email address per line (MIME type: text/plain)
 * - comma-separated values (.csv), tab-separated values (.tsv) and other delimiter-separated values files (MIME
 * types: text/csv and text/tab-separated-values)
 * - Microsoft Excel spreadsheets - .xls and .xlsx - (MIME types: application/vnd.ms-excel and
 * application/vnd.openxmlformats-officedocument.spreadsheetml.sheet).
 */
@Getter
@Setter
@ToString
@AllArgsConstructor
@Builder
public class FileValidationRequest extends AbstractValidationRequest {
    /**
     * An {@link InputStream} (a {@link java.io.FileInputStream}, for example) containing the email addresses to validate.
     */
    @NonNull
    @JsonIgnore
    private InputStream inputStream;

    /**
     * The {@link ContentType} of the provided input file.
     */
    @NonNull
    @JsonIgnore
    private ContentType contentType;

    /**
     * An optional {@link Integer} with the zero-based index of the first row to import and process. If not specified, Verifalia
     * will start processing files from the first (0) row.
     */
    private Integer startingRow;

    /**
     * An optional {@link Integer} with the zero-based index of the last row to import and process. If not specified, Verifalia
     * will process rows until the end of the file.
     */
    private Integer endingRow;

    /**
     * An optional {@link Integer} with the zero-based index of the column to import; applies to comma-separated (.csv),
     * tab-separated (.tsv) and other delimiter-separated values files, and Excel files. If not specified, Verifalia will
     * use the first (0) column.
     */
    private Integer column;

    /**
     * An optional {@link Integer} with the zero-based index of the worksheet to import; applies to Excel files only.
     * If not specified, Verifalia will use the first (0) worksheet.
     */
    private Integer sheet;

    /**
     * Allows to specify the line ending sequence of the provided file; applies to plain-text files, comma-separated (.csv),
     * tab-separated (.tsv) and other delimiter-separated values files.
     */
    @JsonSerialize(using = LineEndingModeSerializer.class, include = JsonSerialize.Inclusion.NON_NULL)