package com.alterdekim.hearthhack.dbf;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import lombok.*;

import java.util.List;
import java.util.Optional;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@ToString

public class DBFCard {
    @JsonProperty("Field")
    @JacksonXmlElementWrapper(useWrapping = false)
    private List<DBFField> fields;

    public Optional<DBFField> findField(String field) {
        return fields.stream().filter(f -> f.getColumn().equals(field)).findFirst();
    }
}
