
package org.hisp.dhis.relationship;

import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.EmbeddedObject;
import org.hisp.dhis.program.Program;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.trackedentity.TrackedEntityType;
import org.hisp.dhis.trackerdataview.TrackerDataView;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

/**
 * @author Stian Sandvold
 */
@JacksonXmlRootElement( localName = "relationshipConstraint", namespace = DxfNamespaces.DXF_2_0 )
public class RelationshipConstraint
    implements EmbeddedObject
{
    private int id;

    private RelationshipEntity relationshipEntity;

    private TrackedEntityType trackedEntityType;

    private Program program;

    private ProgramStage programStage;

    private TrackerDataView trackerDataView;

    public RelationshipConstraint()
    {
    }

    @JsonIgnore
    public void setId( int id )
    {
        this.id = id;
    }

    public int getId()
    {
        return this.id;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public RelationshipEntity getRelationshipEntity()
    {
        return relationshipEntity;
    }

    public void setRelationshipEntity( RelationshipEntity relationshipEntity )
    {
        this.relationshipEntity = relationshipEntity;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public TrackedEntityType getTrackedEntityType()
    {
        return trackedEntityType;
    }

    public void setTrackedEntityType( TrackedEntityType trackedEntityType )
    {
        this.trackedEntityType = trackedEntityType;
    }

    @JsonProperty
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public Program getProgram()
    {
        return program;
    }

    public void setProgram( Program program )
    {
        this.program = program;
    }

    @JsonProperty( )
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public ProgramStage getProgramStage()
    {
        return programStage;
    }

    public void setProgramStage( ProgramStage programStage )
    {
        this.programStage = programStage;
    }

    @JsonProperty( )
    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 )
    public TrackerDataView getTrackerDataView()
    {
        return trackerDataView;
    }

    public void setTrackerDataView( TrackerDataView trackerDataView )
    {
        this.trackerDataView = trackerDataView;
    }

    @Override
    public String toString()
    {
        return "RelationshipConstraint{" +
            "id=" + id +
            ", relationshipEntity=" + relationshipEntity +
            ", trackedEntityType=" + trackedEntityType +
            ", program=" + program +
            ", programStage=" + programStage +
            '}';
    }
}
