CREATE TABLE FCT_TIPODOCCERTSIGN(
    NRTIPODOCCERTSIGN       NUMBER,
    NMTIPODOCCERTSIGN       VARCHAR2(500),
	NRORG             		NUMBER 	     	DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg') 		NOT NULL,
	IDATIVO           		VARCHAR2(1)     DEFAULT 'S' 					NOT NULL
      CONSTRAINT CKC_IDATIVO_FCT_TPDOCCERTSIGN CHECK (IDATIVO IN ('S','N')),
	DTINCLUSAO        		DATE            NULL,
	DTULTATU          		DATE            NULL,
	NRORGINCLUSAO     		NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
	CDOPERINCLUSAO    		VARCHAR2(12)    DEFAULT '1' 					NULL,
	NRORGULTATU       		NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
	CDOPERULTATU      		VARCHAR2(12)    DEFAULT '1',
		CONSTRAINT PK_FCT_TIPODOCCERTSIGN PRIMARY KEY (NRTIPODOCCERTSIGN)

)
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (4, 'Laudo (ate 3 assinaturas - ate 5Mb)', '1')
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (2054, 'Unilateral (1 assinatura - ate 10 Mb)', '1')
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (2176, 'Multilateral (ate 10 assinaturas - ate 100 Mb)', '1')
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (2177, 'Multilateral (ate 10 assinaturas - ate 300 Mb)', '1')
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (2200, 'Multilateral (ate 50 assinaturas - ate 10 Mb)', '1')
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (2294, 'Contrato (ate 10 assinaturas - 10Mb)', '1')
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (2295, 'Declaracao (1 assinatura - ate 500Kb)', '1')
/

INSERT INTO FCT_TIPODOCCERTSIGN (NRTIPODOCCERTSIGN, NMTIPODOCCERTSIGN, CDOPERINCLUSAO) 
	VALUES (2636, 'Multilateral (ate 100 assinaturas - ate 100 Mb)', '1')
/

ALTER TABLE FCT_PARAMETROGERAL ADD IDPADRAOASSINACERTSIGN VARCHAR2(1)
/

ALTER TABLE FCT_PARAMETROGERAL ADD CONSTRAINT CKC_IDPADRAOASSINA_PARAMGERAL
	CHECK (IDPADRAOASSINACERTSIGN IN ('1', '2'))
/

ALTER TABLE FCT_PARAMETROGERAL ADD NRTIPODOCCERTSIGN NUMBER
/

CREATE INDEX SM00365_FK ON FCT_PARAMETROGERAL (NRTIPODOCCERTSIGN ASC)
/

ALTER TABLE FCT_PARAMETROGERAL ADD CONSTRAINT FKSM00365PARGER_TPDOCCERTSIGN
    FOREIGN KEY (NRTIPODOCCERTSIGN) REFERENCES FCT_TIPODOCCERTSIGN(NRTIPODOCCERTSIGN)
/

ALTER TABLE FCT_ORCAMENTOMODELO ADD IDENVIADOCOPERRESPCONCASS VARCHAR2(1)
/

ALTER TABLE FCT_ORCAMENTOMODELO  ADD CONSTRAINT CKC_ENVIADOCCONCASS_ORCMOD CHECK (IDENVIADOCOPERRESPCONCASS IN ('S', 'N'))
/

ALTER TABLE FCT_ORCAMENTOMODELO ADD NRTIPODOCCERTSIGN NUMBER
/

CREATE INDEX SM00366_FK ON FCT_ORCAMENTOMODELO (NRTIPODOCCERTSIGN ASC)
/

ALTER TABLE FCT_ORCAMENTOMODELO ADD CONSTRAINT FKSM00366ORCMOD_TPDOCCERTSIGN
    FOREIGN KEY (NRTIPODOCCERTSIGN) REFERENCES FCT_TIPODOCCERTSIGN(NRTIPODOCCERTSIGN)
/

ALTER TABLE FCT_MODELOCONTRATO ADD IDENVIADOCOPERRESPCONCASS VARCHAR2(1)
/

ALTER TABLE FCT_MODELOCONTRATO ADD CONSTRAINT CKC_ENVIADOCCONCASS_MODCONT CHECK (IDENVIADOCOPERRESPCONCASS IN ('S', 'N'))
/

ALTER TABLE FCT_MODELOCONTRATO ADD NRTIPODOCCERTSIGN NUMBER
/

CREATE INDEX SM00367_FK ON FCT_MODELOCONTRATO (NRTIPODOCCERTSIGN ASC)
/

ALTER TABLE FCT_MODELOCONTRATO ADD CONSTRAINT FKSM00367MODCONT_TPDOCCERTSIGN
    FOREIGN KEY (NRTIPODOCCERTSIGN) REFERENCES FCT_TIPODOCCERTSIGN(NRTIPODOCCERTSIGN)
/

ALTER TABLE FCT_ORCAMENTO ADD IDENVIADOCOPERRESPCONCASS VARCHAR2(1)
/

ALTER TABLE FCT_ORCAMENTO  ADD CONSTRAINT CKC_ENVIADOCCONCASS_ORC CHECK (IDENVIADOCOPERRESPCONCASS IN ('S', 'N'))
/

ALTER TABLE FCT_CONTRATO ADD IDENVIADOCOPERRESPCONCASS VARCHAR2(1)
/

ALTER TABLE FCT_CONTRATO  ADD CONSTRAINT CKC_ENVIADOCCONCASS_CONT CHECK (IDENVIADOCOPERRESPCONCASS IN ('S', 'N'))
/