/*
 * Copyright (C) 2014 Jens
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package de.jensheuschkel.dentalimageviewer.database;

import de.jensheuschkel.dentalimageviewer.container.Image;
import de.jensheuschkel.dentalimageviewer.container.Patient;
import de.jensheuschkel.dentalimageviewer.container.TagEntry;
import de.jensheuschkel.dentalimageviewer.container.UploadableImage;
import java.sql.SQLException;
import java.util.List;

/**
 *
 * @author Jens
 */
public interface DaoConnection {

    boolean open() throws SQLException;

    void close();

    List<Image> getAllImages() throws SQLException;

    List<Image> getImagesForPatientId(long id) throws SQLException;

    List<TagEntry> getAllTags() throws SQLException;

    // darf nicht null zurück geben !
    List<TagEntry> getAllTagsForPatientId(long id) throws SQLException;

    void initDb() throws SQLException;

    boolean checkDbConnectionCredentials(DbCredentials credentials);

    void addTag(String value) throws SQLException;

    void addImage(UploadableImage image) throws SQLException;

    public List<String> getAllAvailableTags() throws SQLException;

    public byte[] loadThumbImage(String id) throws SQLException;

    public void deleteImage(String id) throws SQLException;

    public String getKey(String key) throws SQLException;

    public void setKey(String key, String value) throws SQLException;

    public void updateImageDetails(Image image) throws SQLException;

    public byte[] loadFullImage(String id) throws SQLException;

    public void saveOrUpdatePatient(Patient patient) throws SQLException;

    public List<Patient> getAllPatiens() throws SQLException;
}
