package com.atlassian.stash.internal.web.attach;

import com.atlassian.stash.internal.attach.AttachmentSupplier;
import com.atlassian.stash.internal.web.util.MultipartStreamSupplier;
import com.google.common.collect.Lists;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @since 3.1
 */
public class AttachmentForm {

    private List<MultipartFile> files;

    public AttachmentForm() {
    }

    public List<MultipartFile> getFiles() {
        return files;
    }

    public void setFiles(List<MultipartFile> files) {
        this.files = files;
    }

    public List<AttachmentSupplier> toSuppliers() {
        return Lists.transform(files, MultipartStreamSupplier.<AttachmentSupplier>transform());
    }
}
