drop table if exists extended_properties cascade;
create table extended_properties(
	extended_property_id serial not null,
	ep_name varchar(64) not null,
	ep_type varchar(16) not null,
	ep_multilang boolean not null default false,
	constraint extended_properties_extended_property_id_pkey primary key( extended_property_id )
);

comment on table extended_properties is 'storage of extended properties';
comment on column extended_properties.extended_property_id is 'unique id of table';
comment on column extended_properties.ep_name is 'name of the extended property';
comment on column extended_properties.ep_type is 'type of the extended_property (checkbox/textbox)';
comment on column extended_properties.ep_multilang is 'multilang flag of extended_property (true => multilingual (different values for different languages))';

comment on constraint extended_properties_extended_property_id_pkey on extended_properties is 'unique constraint of table';

insert into extended_properties( ep_name , ep_type ) values( 'experience_5+' ,'checkbox');
insert into extended_properties( ep_name , ep_type ) values( 'native_language' ,'checkbox');
insert into extended_properties( ep_name , ep_type ) values( 'certificate' ,'checkbox');
insert into extended_properties( ep_name , ep_type ) values( 'invoice' ,'checkbox');
insert into extended_properties( ep_name , ep_type , ep_multilang ) values( 'services' ,'text' , true );
insert into extended_properties( ep_name , ep_type , ep_multilang ) values( 'references' ,'text' , true );
insert into extended_properties( ep_name , ep_type , ep_multilang ) values( 'use_langsite' , 'checkbox' , true );
insert into extended_properties( ep_name , ep_type , ep_multilang ) values( 'langsite_name' , 'text' , true );
insert into extended_properties( ep_name , ep_type ) values( 'show_blueboard_score' , 'checkbox' );
insert into extended_properties( ep_name , ep_type , ep_multilang ) values( 'custom_specialty' , 'text' , true );
insert into extended_properties( ep_name , ep_type , ep_multilang ) values( 'native_language_text' , 'text' , true );

drop table if exists extended_property_langdefs;
create table extended_property_langdefs(
	extended_property_id integer not null references extended_properties( extended_property_id ),
	language_id integer not null references languages( language_id ),
	langdef_name varchar(64)
);

comment on table extended_property_langdefs is 'storage of extended property_langdefs';
comment on column extended_property_langdefs.extended_property_id is 'reference id to extended_properties table';
comment on column extended_property_langdefs.language_id  is 'reference id to languages table';
comment on column extended_property_langdefs.langdef_name is 'language definition of extended property';

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(1,1,'Több mint 5 éves fordítói tapasztalat');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(1,2,'Experience in translating (more than 5 years)');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(2,1,'Anyanyelvi szintû nyelvismeret');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(2,2,'Native language proficiency');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(3,1,'Fordítói szakképesítés (pl. oklevél)');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(3,2,'Degree in translation');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(4,1,'Számlaképesség');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(4,2,'I can issue an invoice');

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(5,1,'Szolgáltatások');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(5,2,'Services');

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(6,1,'Referenciák');
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(6,2,'References');

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(7,1,'Jelenjen meg ezen az oldalon is az adatlapom' );
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(7,2,'My profile is visible on this site also' );

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(8,1,'Az adott nyelven megjelenített név' );
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(8,2,'Name appears on site' );

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(9,1,'A visszajelzéseim megjelenjenek a profil oldalamon' );
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(9,2,'Show my score on my profile page' );

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(10,1,'egyéb szakterület' );
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(10,2,'custom specialty' );

insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(11,1,'anyanyelv' );
insert into extended_property_langdefs( extended_property_id , language_id , langdef_name ) values
	(11,2,'native_language' );


