package com.rthoni.intellij.codefromds.dbo.template;

import java.util.List;

/**
 * Created by robin on 11/18/16.
 */
public class ForeignKeyDbo {

    private TableDataSourceDbo _sourceTable;

    private List<ColumnDataSourceDbo> _sourceColumns;

    private TableDataSourceDbo _targetTable;

    private List<ColumnDataSourceDbo> _targetColumns;

    private String _sourceForeignKeyName;

    private String _targetForeignKeyName;

    private String _name;

    public TableDataSourceDbo getSourceTable() {
        return _sourceTable;
    }

    public boolean isSelected()
    {
        return _sourceColumns.stream().allMatch(ColumnDataSourceDbo::isSelected) &&
                _targetColumns.stream().allMatch(ColumnDataSourceDbo::isSelected);
    }

    public void setSourceTable(TableDataSourceDbo sourceTable) {
        _sourceTable = sourceTable;
    }

    public List<ColumnDataSourceDbo> getSourceColumns() {
        return _sourceColumns;
    }

    public void setSourceColumns(List<ColumnDataSourceDbo> sourceColumns) {
        _sourceColumns = sourceColumns;
    }

    public TableDataSourceDbo getTargetTable() {
        return _targetTable;
    }

    public void setTargetTable(TableDataSourceDbo targetTable) {
        _targetTable = targetTable;
    }

    public List<ColumnDataSourceDbo> getTargetColumns() {
        return _targetColumns;
    }

    public void setTargetColumns(List<ColumnDataSourceDbo> targetColumns) {
        _targetColumns = targetColumns;
    }

    public String getSourceForeignKeyName() {
        return _sourceForeignKeyName;
    }

    public void setSourceForeignKeyName(String sourceForeignKeyName) {
        _sourceForeignKeyName = sourceForeignKeyName;
    }

    public String getTargetForeignKeyName() {
        return _targetForeignKeyName;
    }

    public void setTargetForeignKeyName(String targetForeignKeyName) {
        _targetForeignKeyName = targetForeignKeyName;
    }

    public String getName() {
        return _name;
    }

    public void setName(String name) {
        _name = name;
    }
}
