// Path: src/main/java/au/com/anthonybruno/record/Record.java
// public interface Record extends Iterable<Object> {
// 
//     Object get(int index);
// 
//     Object get(String fieldName);
// }
// 
// Path: src/main/java/au/com/anthonybruno/settings/CsvSettings.java
// public class CsvSettings extends FlatFileSettings {
// 
//     public static final char DEFAULT_DELIMITER = ',';
// 
//     private final char delimiter;
// 
//     public CsvSettings(boolean includeHeaders) {
//         this(includeHeaders, DEFAULT_DELIMITER);
//     }
// 
//     public CsvSettings(boolean includeHeaders, char delimiter) {
//         super(includeHeaders);
//         this.delimiter = delimiter;
//     }
// 
//     public char getDelimiter() {
//         return delimiter;
//     }
// 
//     public static class Builder {
//         private char delimiter = DEFAULT_DELIMITER;
//         private boolean includeHeaders = true;
// 
//         public Builder setDelimiter(char delimiter) {
//             this.delimiter = delimiter;
//             return this;
//         }
// 
//         public Builder setIncludeHeaders(boolean includeHeaders) {
//             this.includeHeaders = includeHeaders;
//             return this;
//         }
// 
//         public CsvSettings build() {
//             return new CsvSettings(includeHeaders, delimiter);
//         }
//     }
// 
// }


import au.com.anthonybruno.record.Record;
import au.com.anthonybruno.settings.CsvSettings;
import com.univocity.parsers.csv.CsvWriter;
import com.univocity.parsers.csv.CsvWriterSettings;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
package au.com.anthonybruno.writer.csv;



public class UnivocityCsvWriter extends AbstractCsvWriter {

    private final CsvWriter csvWriter;

    public UnivocityCsvWriter(Writer writer, CsvSettings settings) {
        super(writer, settings);
        CsvWriterSettings csvWriterSettings = new CsvWriterSettings();
        csvWriterSettings.getFormat().setDelimiter(settings.getDelimiter());
        this.csvWriter = new CsvWriter(writer, csvWriterSettings);
    }

    @Override
    public void writeRow(List<String> row) {
        for (String value : row) {
            csvWriter.addValue(value);
        }
        csvWriter.writeValuesToRow();
    }

    @Override
    public void close() {
        csvWriter.close();
    }

    @Override
    public void writeRecord(Record record) {
        List<String> values = new ArrayList<>();
        record.forEach((value) -> {
// Path: src/main/java/au/com/anthonybruno/record/Record.java
// public interface Record extends Iterable<Object> {
// 
//     Object get(int index);
// 
//     Object get(String fieldName);
// }
// 
// Path: src/main/java/au/com/anthonybruno/settings/CsvSettings.java
// public class CsvSettings extends FlatFileSettings {
// 
//     public static final char DEFAULT_DELIMITER = ',';
// 
//     private final char delimiter;
// 
//     public CsvSettings(boolean includeHeaders) {
//         this(includeHeaders, DEFAULT_DELIMITER);
//     }
// 
//     public CsvSettings(boolean includeHeaders, char delimiter) {
//         super(includeHeaders);
//         this.delimiter = delimiter;
//     }
// 
//     public char getDelimiter() {
//         return delimiter;
//     }
// 
//     public static class Builder {
//         private char delimiter = DEFAULT_DELIMITER;
//         private boolean includeHeaders = true;
// 
//         public Builder setDelimiter(char delimiter) {
//             this.delimiter = delimiter;
//             return this;
//         }
// 
//         public Builder setIncludeHeaders(boolean includeHeaders) {
//             this.includeHeaders = includeHeaders;
//             return this;
//         }
// 
//         public CsvSettings build() {
//             return new CsvSettings(includeHeaders, delimiter);
//         }
//     }
// 
// }


// Path: src/main/java/au/com/anthonybruno/writer/csv/UnivocityCsvWriter.java
import au.com.anthonybruno.record.Record;
import au.com.anthonybruno.settings.CsvSettings;
import com.univocity.parsers.csv.CsvWriter;
import com.univocity.parsers.csv.CsvWriterSettings;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;

package au.com.anthonybruno.writer.csv;



public class UnivocityCsvWriter extends AbstractCsvWriter {

    private final CsvWriter csvWriter;

    public UnivocityCsvWriter(Writer writer, CsvSettings settings) {
        super(writer, settings);
        CsvWriterSettings csvWriterSettings = new CsvWriterSettings();
        csvWriterSettings.getFormat().setDelimiter(settings.getDelimiter());
        this.csvWriter = new CsvWriter(writer, csvWriterSettings);
    }

    @Override
    public void writeRow(List<String> row) {
        for (String value : row) {
            csvWriter.addValue(value);
        }
        csvWriter.writeValuesToRow();
    }

    @Override
    public void close() {
        csvWriter.close();
    }

    @Override
    public void writeRecord(Record record) {
        List<String> values = new ArrayList<>();
        record.forEach((value) -> {
            values.add(value.toString());