<?php

class Atendimento_Model_TipoPendencia extends Agro_Db_Table_Abstract {
    const ID_PENDENCIA_CONFERENCIA = 1;
    const ID_PENDENCIA_DOCUMENTOS_SINISTRO = 2;

	protected $_schema = 'atendimento';
	protected $_name = 'tipo_pendencia';
	protected $_primary = 'id';
	public $_order = 'ds_tipo_pendencia';

	public function save($data) {
		
		$Row = $this->getRow($data['id']);
		
		$Row->ds_tipo_pendencia = $data['ds_tipo_pendencia'];
		$Row->ds_chave = $data['ds_chave'];
		
		return $Row->save();
	}

    public function getIdTipoPendencia(string $dsChave) : int {
        return $this->fetchRow("ds_chave = '$dsChave'")['id'];
    }
}