/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cz.csu.sdmx.validation.model;

import java.util.List;

/**
 *
 * @author themi
 */
public class Dimension {
    private String name;
    private boolean required;
    private List<String> validValues;

    public Dimension(String name, List<String> validValues){
       this.name = name;
       this.validValues = validValues;
       this.required = false;
    }
    
    public Dimension(String name, boolean required, List<String> validValues){
       this.name = name;
       this.required = required;
       this.validValues = validValues;
    }

    public String getName() {
        return name;
    }

    public List<String> getValidValues() {
        return validValues;
    }

    @Override
    public String toString() {
        return name;
    }
    
    public boolean isRequired() {
        return required;
    }
    
    public boolean isValidValue(String value){
        if(validValues.isEmpty())
            return true;
        
        return validValues.contains(value);
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setRequired(boolean required) {
        this.required = required;
    }

    public void setValidValues(List<String> validValues) {
        this.validValues = validValues;
    }
    
}
