Module:کارډ/آلې/ځای

د ويکيپېډيا، وړیا پوهنغونډ له خوا

لاسوند لپاره ددې موډيول کېدای سی په Module:کارډ/آلې/ځای/لاسوند کي وي

-- Credits:
-- Original from وحدة:بطاقة/أدوات/مبنى
-- forked and developed by وهراني @arwiki (ar:وحدة:بطاقة/أدوات/مبنى)
-- Version: 20240301

local building = {}
local localdata = require("Module:کارډ/آلې")
local item = localdata.item

local general = require "Module:کارډ/آلې"

local WD = require "Module:Wikidata.Ca"

local function keyDate(event)
    if type(event) == "table" then
        for i, j in pairs(event) do
            local s = keyDate(j)
            if s then
                return s
            end
        end
    elseif type(event) ~= "string" then
        return error("invalid-datatype !! " .. type(event) .. " != string")
    elseif string.sub(event, 1, 1) == "Q" then
        return WD.claim {
            property = "P793",
            qualifier = "P518",

            qualifier2 = "P580 or P582", --i
            qualifier3 = "P580", qualifier4 = "P582",
            qualifier5 = "P585",

            colformat2 = "Y", colformat3 = "Y",
            colformat4 = "Y", colformat5 = "Y",

            rowsubformat2 = ' $3 – $4',
            rowsubformat5 = ' $5',

            formatting = "table",
            conjunction = "<br />",
            rowformat = "$1$2$5$R0",
            whitelist0 = event,
            query = "num"
        }
    elseif string.sub(event, 1, 1) == "P" then
        return WD.claim {property = event, query = "num"}
    else
        return error("invalid-entity-id : " .. event)
    end
end

function building.title()
    return general.title()
end

--Image
function building.mainimage(params)
    return general.mainimage(params)
end

function building.country(params)
    if(type(params) ~='table') then params={} end
    return {
        type = params.type or "row",
        label = params.label or "البلد",
        value = params.value or {"دولة", "بلد", "country"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P17", listrank="bestrank",
            formatting = "table",
            conjunction = "<br />",
            rowformat = "{{flag|$0}}$R0",
            colformat0 = "label"
        },
        metadata = {
			description = "دولة ذات سيادة لهذا الموضوع",
			option = "", 
			type = "string", 
        }
    }
end



function building.status()
    return {
                type = "row",
                label = "الحالة",
                value = {"الوضع_الحالي", "status"},
                wikidata = {property = "P5816"},
                metadata = {
                    description = "للدلالة على الوضعية الحالية",
                    option = "", 
                    type = "string", 
					suggestedvalues = {"مكتمل","مهدم","مدمر","عمليات البناء معلقة"
						,"قيد الإنشاء","لم يتم بناءه"
						,"مقترح","موافق على بناءه"},
                }
            }
end

function building.historicalregion()
    return {-- بالنسبة للمناطق التاريخية
        type = "row",
        value = {"منطقة تاريخية", "historical_region"},
        label = "المنطقة التاريخية",
        wikidata = {property = "P6885"},
        metadata = {
			description = "المنطقة التاريخية القديمة",
			option = "", 
			type = "", 
        }
    }
end

function building.adminlocation()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                value = {"عنوان", "address"},
                label = "العنوان",
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P6375",
                    list = 2,
                    conjunction = "<br />",
                    formatting = "$text {{Language icon|NoCat=y|$language}}"
                },
		        metadata = {
					description = "ما توفر من : الرقم واسم الشارع والحي",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                value = {"اسم المنطقة 1","subdivision_name1", "subdivision1"},
                label = {"نوع المنطقة 1","subdivision_type1"} ,
                defaultlabel = "المنطقة 1",
                metadata = {
					description = "",
					option = "", 
					type = "", 
                }
            },
            {
                type = "row",
                value = {"اسم المنطقة 2","subdivision_name2", "subdivision2"},
                label = {"نوع المنطقة 2","subdivision_type2"} ,
                defaultlabel = "المنطقة 2",
                metadata = {
					description = "",
					option = "", 
					type = "", 
                }
            },
            {
                type = "row",
                value = {"اسم المنطقة 3","subdivision_name3", "subdivision3"},
                label = {"نوع المنطقة 3","subdivision_type3"} ,
                defaultlabel = "المنطقة 3",
                metadata = {
					description = "",
					option = "", 
					type = "", 
                }
            },
            {-- بالنسبة للمناطق الإدارية
                type = "row",
                value = {"منطقة_إدارية", "administrative_territorial "},
                label = "المنطقة الإدارية",
                wikidata = {wikimod = "Wikidata.Ca", property = "P131", listrank='bestrank', showDate = "true"},
                metadata = {
					description = "الإقليم التابع له إداريا",
					option = "", 
					type = "", 
                }
            },
            building.historicalregion(),
            building.country()
        }
    }
end

function building.onshoreof()
    return {
        type = "row",
        label = "على ضفاف",
        value = {"على_ضفاف","on_coast_of","baigné par"},
        wikidata = {property = "P206"},
        metadata = {
			description = "موجود بالقرب من المسطح المائي",
			option = "", 
			type = "", 
        }
    }
end

function building.watershed()
    return {
        type = "row",
        label = "مستجمع مائي",
        value = "مستجمع مائي",
        wikidata = {property = "P4614"},
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.protectedarea()
    return {
        type = "row",
        label = "منطقة محمية",
        plurallabel = "مناطق محمية",
        value = {"منطقة محمية", "protected_area"},
        wikidata = {property = "P3018"},
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.island()
    return {
        type = "row",
        label = "جزيرة",
        plurallabel = "جزر",
        value = {"جزيرة", "island"},
        wikidata={property = "P5130"},
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.mountainrange()
    return {
        type = "row",
        label = "السلسلة الجبلية",
        plurallabel = "السلاسل الجبلية",
        value = {"جبل", "سلسلة جبلية", "mountain_range"},
        wikidata = {property = "P4552"},
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.elevation()
    return {
        type = "row",
        label = "الارتفاع",
        value = {"ارتفاع", "elevation"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P2044",
            formatting = "unitlinked"
        },
        metadata = {
			description = "الارتفاع عن مستوى البحر",
			option = "", 
			type = "", 
        }
    }
end

function building.coordinates(args)
    return general.coordinates(args)
end

function building.website(args)
    return general.website(args)
end

function building.phone_number()
    return {
                type = "row", 
                label = "رقم الهاتف",
                value = {"رقم الهاتف", "رقم_الهاتف","phone_number"},
                valueStyle = {direction = "LTR", ["text-align"] = "left"},
                wikidata = {property = "P1329"},
                metadata = {
					description = "رقم الهاتف",
					option = "", 
					type = "string", 
                }
            }
end


function building.postal_code()
    return {
        type = "row", 
        label = "الرمز البريدي",
        value = {"الرمز_البريدي","postal_code"},
        wikidata = {property = "P281"},
        metadata = {
			description = "معرف السلطة البريد لمنطقة أو مبنى",
			option = "", 
			type = "", 
        }
    }
end

function building.open_days()
    return {
			type = 'row' , 
			label = 'مفتوح في' , 
        	value = {'مفتوح','open_days'} , 
        	wikidata = {
        		wikimod = "Wikidata.Ca",
            	property='P3025', formatting='table',
        		qualifier='P3027', qualifier2='P3028', 
        		qualifier3='P3026', 
        		qualifier4='P8626',qualifier5='P8627',
                rowformat= '$0$R0 $1$4$3', 
                rowsubformat1='<small><br/>$1 – $2</small>',
                rowsubformat3='<small><br/> مغلق يوم: $3</small>',
                rowsubformat4='<small><br/>$4 – $5</small>',
    	},
        metadata = {
			description = "توقيت الفتح والغلق",
			option = "", 
			type = "", 
        }
	}
end

function building.cornerstonelaying()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                value = {"حجر_الأساس", "تاريخ_وضع_حجر_الأساس", "groundbreaking_date", "broke_ground", "broke ground"},
                label = "وضع حجر الأساس",
                wikidata = keyDate("Q18752057"),
                metadata = {
					description = "تاريخ وضع حجر الأساس للموضوع",
					option = "", 
					type = "date", 
                }
            }
        }
    }
end

function building.construction()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                label = "بداية التشييد",
                value = {"بداية_التشييد", "تاريخ_بدء_البناء", "start_date", "construction_start_date"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P793",
                    qualifier = "P580 or P585",
                    formatting = "table",
                    conjunction = "<br />",
                    rowformat = "$1",
                    whitelist0 = "Q385378,Q27136782"
                },
                --wikidata2 = {property = "P571"},
                metadata = {
					description = "تاريخ بداية التشييد",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                label = "توقف التشييد",
                value = {"توقف_التشييد", "توقف_البناء", "stop_date", "construction_stop_date"},
                --, wikidata = {property='P'},
                metadata = {
					description = "تاريخ توقف التشييد",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                label = "نهاية الأعمال الكبرى",
                value = {"نهاية_الأعمال_الكبرى", "topped_out_date"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P793",
                    qualifier = "P585",
                    formatting = "table",
                    conjunction = "<br />",
                    rowformat = "$1",
                    whitelist0 = "Q1075723"
                },
                metadata = {
					description = "تاريخ نهاية الأعمال الكبرى",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                label = "الانتهاء",
                value = {"نهاية_التشييد", "تاريخ_الانتهاء", "est_completion", "completion_date"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P793",
                    qualifier = "P582",
                    formatting = "table",
                    conjunction = "<br />",
                    rowformat = "$1",
                    whitelist0 = "Q385378"
                },
                metadata = {
					description = "تاريخ أعمال الانتهاء",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                value = {"تشييد", "التشييد", "التشييد"},
                label = "التشييد",
                --wikidata = {property='P'},
                metadata = {
					description = "",
					option = "", 
					type = "", 
                }
            }
        }
    }
end

function building.reconstruction()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                value = {"بداية إعادة التشييد", "reconstruction_start_date"},
                label = "بداية إعادة التشييد",
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                value = {"نهاية إعادة التشييد", "reconstruction_completion_date"},
                label = "نهاية إعادة التشييد",
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                value = {"إعادة التشييد", "تاريخ إعادة التشييد"},
                label = "إعادة التشييد",
                wikidata = keyDate("Q1370468"),
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            }
        }
    }
end

function building.opening()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                value = {"تاريخ الافتتاح", "تاريخ_الافتتاح", "opened", "opening_date", "opening"},
                label = "الافتتاح",
                blockers = "افتتاح",
                wikidata = keyDate {"Q1417098,Q15051339"},
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                value = {"تاريخ_الافتتاح_الرسمي", "inauguration_date"},
                label = "الافتتاح الرسمي",
                blockers = "افتتاح",
                -- P1619 = الافتتاح الرسمي, وليس دائما الافتتاح الفعلي
                wikidata = keyDate {"P1619"}, 
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                label = "التكريس",
                value = {"تكريس", "consecration"},
                blockers = "افتتاح",
                wikidata = keyDate {"Q125375"}, 
                metadata = {
					description = "",
					option = "", 
					type = "", 
                }
            },
            {
                type = "row",
                value = "أول ضوء",
                label = "[[|أول ضوء (علم الفلك)|]]",
                blockers = "افتتاح",
                wikidata = keyDate {"Q1306940"}, 
                metadata = {
					description = "",
					option = "", 
					type = "", 
                }
            }
        }
    }
end

function building.renovation()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                description = "تاريخ التحديث",
                label = "التحديث",
                value = {"تاريخ_تحديث_المبنى", "renovation_date"},
                --, wikidata = {property='P'}, 
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                description = "تاريخ الترميم",
                value = {"ترميم", "restoration"},
                label = "الترميم",
                wikidata = keyDate {"Q217102"},
                blockers = "تجديد", 
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                description = "تاريخ التجديد",
                value = {"تجديد", "renovation"},
                label = "التجديد",
                wikidata = keyDate {"Q2144402"},
                blockers = "ترميم", 
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                description = "تاريخ التوسعة",
                value = {"توسعة", "التوسعة", "expansion"},
                label = "التوسعة",
                wikidata = keyDate {"Q9073584"},
                blockers = "تجديد", 
                metadata = {
					description = "",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                value = "أشغال أخرى",
                label = "أشغال أخرى", 
                metadata = {
					description = "تاريخ أشغال أخرى",
					option = "", 
					type = "date", 
                }
            }
        }
    }
end

function building.demolition()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                label = "الهدم",
                value = {"تاريخ_هدم_المبنى", "date_demolished", "demolished_date"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P576",
                    qualifier = "P770",
                    formatting = "table",
                    conjunction = "<br />",
                    rowformat = "$0$R0 $1",
                    rowsubformat1 = "<small>($1)</small>"
                },
                wikidata2 = keyDate("Q331483"), 
                metadata = {
					description = "تاريخ الهدم",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                label = "التدمير",
                value = {"تاريخ_تدمير_المبنى", "destruction_date", "destroyed"},
                wikidata = {property = "P3082"},
                wikidata2 = keyDate("Q17781833"), 
                metadata = {
					description = "تاريخ التدمير",
					option = "", 
					type = "date", 
                }
            },
            {
                type = "row",
                value = {"تخريب", "vandalism"},
                label = "التخريب",
                wikidata = keyDate("Q6160"), 
                metadata = {
					description = "تاريخ التخريب",
					option = "", 
					type = "date", 
                }
            },
        }
    }
end

function building.closure()
    return {
        type = "row",
        value = {"الإقفال", "تاريخ_الإقفال", "تاريخ_الاغلاق", "closing_date", "closed"},
        label = "الإقفال",
        wikidata = keyDate {"Q5135520"},
        wikidata2 = keyDate {"P3999"},
        wikidata3 = keyDate {"P576"}, 
        metadata = {
			description = "تاريخ الاغلاق",
			option = "", 
			type = "date", 
        }
    }
end

function building.maintenance()
    return {
        type = "row",
        value = {"صيانة", "maintenance"},
        label = "الصيانة",
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P126",
            showDate = "true",
            conjunction = "<br />"
        }, 
        metadata = {
			description = "تاريخ الصيانة",
			option = "", 
			type = "date", 
        }
    }
end

function building.usage()
    return {
        type = "row",
        label = "الاستعمال",
        value = {"استعمال","الاستعمال","usage"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P366",
            showDate = "true",
            conjunction = "<br />",
            list = "bestrank"
        }, 
        metadata = {
			description = "الاستخدام الرئيسي  (الحالي والسابق)",
			option = "", 
			type = "", 
        }
    }
end

function building.operator()
    return {
        type = "row",
        label = "الإدارة",
        value = {"إدارة", "مسير", "المشغل", "operator", "الإدارة"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P137",
            showDate = "true",
            conjunction = "<br />"
        }, 
        metadata = {
			description = "الشخص أو الهيئة التي تدير المرفق",
			option = "", 
			type = "", 
        }
    }
end

function building.transport()
    return {
        type = "multi",
        rows = {
            {type = "row", label = "الموقف", value = "موقف"},
            {type = "row", label = "محطة", value = "محطة"},
            {type = "row", label = "الميترو", value = "ميترو"},
            {type = "row", label = "ترمواي", value = {"قطار", "ترمواي"}},
            {type = "row", label = "حافلة", value = {"باص", "حافلة"}}
        }
    }
end

function building.part_of() 
    return {
        type = "row",
        label = "جزء من",
        value = "جزء من",
        wikidata = {
            property = "P361"
        }, 
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.orientation()
    return {
        type = "row",
        label = "الإتجاه",
        value = {"إتجاه", "orientation"},
        wikidata = {property = "P7469", numval = "1"}, 
        metadata = {
			description = "",
			option = "", 
			type = "",
			suggestedvalues = {"شمال","جنوب","شرق","غرب","شمال-شرق","شمال-غرب","جنوب-شرق","جنوب-غرب"},
        }
    }
end

function building.archistyle()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                label = "النمط المعماري",
                plurallabel = "الأنماط المعمارية",
                value = {"النمط_المعماري", "طراز_معماري", "architectural_style", "architecture"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P149 OR P135"
                }, 
		        metadata = {
					description = "النمط المعماري المنتهج في التشييد",
					option = "", 
					type = "", 
		        }
            }
        }
    }
end

function building.creator()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                label = "المهندس المعماري",
                plurallabel = "المهندسون المعماريون",
                value = {"معماري", "المهندس المعماري", "المهندس_المعماري", "architect"},
                wikidata = {property = "P84", conjunction = "<br />"}, 
		        metadata = {
					description = "المهندس المعماري",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المهندس المدني",
                plurallabel = "المهندسون المدنيون",
                value = {"مهندس_مدني", "المهندس_المدني", "civil_engineer"},
                --wikidata = {property = "P", conjunction = "<br />"}, 
		        metadata = {
					description = "المهندس المدني",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المهندس الإنشائي",
                plurallabel = "المهندسون الإنشائيون",
                value = {"مهندس", "المهندس_الإنشائي"},
                "structural_engineer",
                wikidata = {property = "P631", conjunction = "<br />"}, 
		        metadata = {
					description = "المهندس الإنشائي",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المصمم",
                plurallabel = "المصممون",
                value = {"مصمم", "المصمم", "designer"},
                wikidata = {property = "P170", conjunction = "<br />"}, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "مصممون آخرون",
                value = {"مصممين_آخرون", "other_designers"}, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            }
        }
    }
end

function building.owner()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                description = "المالك لأرض المبنى",
                label = "مالك الأرض",
                value = {"مالك_الأرض", "landlord"},
                --, wikidata = {property='P'}, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المالك الأول",
                plurallabel = "الملاك الأوائل",
                value = "المالك الأول", 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المالك الحالي",
                plurallabel = "الملاك الحاليون",
                value = "المالك الحالي", 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المالك",
                plurallabel = "الملاك",
                value = {"مالك", "owner", "المالك"},
                wikidata = {
                	wikimod = "Wikidata.Ca", 
                	property = "P127",
                	conjunction="<br />",
                	showDate="true"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            }
        }
    }
end

function building.religion()
    return {
        type = "row",
        label = "الديانة",
        value = {"ديانة", "دين", "religion"},
        wikidata={property = "P140"}, 
        metadata = {
			description = "الديانة التي تمارس طقوسها في هذا المبنى",
			option = "", 
			type = "", 
        }
    }
end

function building.shape()
    return {
        type = "row",
        label = "الشكل",
        value = {"شكل", "shape"},
        property = "P1419", 
        metadata = {
			description = "الشكل الهندسي",
			option = "", 
			type = "", 
        }
    }
end

function building.dimensions()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                label = "الارتفاع",
                value = {"ارتفاع", "height"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2048",
                    qualifier = "P518 OR P1013",
                    list = "bestrank",
                    colformat0 = "unitlinked",
                    formatting = "table",
                    conjunction = "<br />",
                    rowformat = "$0$R0 $1",
                    rowsubformat1 = "<small><br />($1)</small>",
                    blacklist1 = "Q31271474,Q24192182,Q131214,Q852590"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "الارتفاع الهندسي",
                value = {"ارتفاع هندسي","architectural height"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2048",
                    colformat0 = "unitlinked",
                    formatting = "table",
                    qualifier1 = "P1013 OR P518",
                    rowformat = "$0$R0",
                    whitelist1 = "Q24192182"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "ارتفاع الهوائي",
                value = {"برج_الهوائي", "antenna_spire"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2048",
                    colformat0 = "unitlinked",
                    formatting = "table",
                    qualifier = "P1013 OR P518",
                    rowformat = "$0$R0",
                    whitelist1 = "Q131214,Q852590"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "أعلى طابق",
                value = {"أعلى طابق", "top_floor"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2048",
                    colformat0 = "unitlinked",
                    formatting = "table",
                    qualifier = "P1013",
                    rowformat = "$0$R0",
                    whitelist1 = "Q31271474"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "العمق",
                value = "عمق",
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2610",
                    formatting = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "الطول",
                value = {"طول","length"},
                wikidata = {
                	wikimod = "Wikidata.Ca", 
                	formatting="table",
                    property = "P2043", qualifier1="P560",
                    rowformat= "$0$R0 $1", rowsubformat1="<small>($1)</small>",
                    conjunction = "<br />",
                    colformat0 = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "العرض",
                value = {"عرض","width"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2049",
                    formatting = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "الباع",
                value = {"باع","span"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2050",
                    formatting = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "القطر",
                value = {"قطر", "قطر_المبنى", "diameter"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2386",
                    formatting = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المحيط",
                value = {"محيط", "محيط_المبنى", "circumference"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2547",
                    formatting = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المساحة",
                value = {"المساحة", "مساحة","area"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2046",
                    formatting = "table",
                    conjunction = "<br />",
                    qualifier = "P518",
                    rowformat = "$0$R0 $1",
                    rowsubformat1 = "<small>($1)</small>",
                    colformat0 = "unitlinked"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "الحجم",
                value = {"حجم", "volume"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2234",
                    formatting = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المسافة التحتية",
                value = {"مسافة تحتية", "clearance"},
                wikidata = {
                    wikimod = "Wikidata.Ca",
                    property = "P2793",
                    formatting = "unit"
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            }
        }
    }
end

function building.floors()
    return {
        type = "multi",
        rows = {
            {
                type = "row",
                label = "مساحة الطابق",
                value = {"مساحة_الطابق_الواحد", "floor_area"}, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "الطوابق",
                value = {
                    "الطوابق",
                    "طوابق",
                    "عدد الطوابق",
                    "عدد_الطوابق",
                    "طوابق_فوق_الأرض",
                    "floors above ground",
                    "floor_count"
                },
                wikidata={property = "P1101"}, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "الطوابق الأرضية",
                value = {
                    "الطوابق الأرضية",
                    "طوابق أرضية",
                    "عدد الطوابق الأرضية",
                    "طوابق تحت الأرض",
                    "floors below ground"
                },
                wikidata={property = "P1139"}, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            }
        }
    }
end

function building.causeOfDestruction()
    return {
        type = "row",
        label = "سبب الدمار",
        value = {"سبب الدمار", "cause of destruction"},
        wikidata = {property = "P770"}, 
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end
building.destroyedby = building.causeOfDestruction

function building.material()
    return {
        type = "row",
        label = "مادة البناء",
        plurallabel = "مواد البناء",
        value = {"مادة البناء", "المواد_المستخدمة", "material"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P186",
            qualifier = "P518",
            formatting = "table",
            conjunction = "<br />",
            rowformat = "$0$R0 $1",
            rowsubformat1 = "<small>($1)</small>"
        }, 
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.colour()
    return {
        type = "row",
        label = "اللون",
        plurallabel = "الألوان",
        value = {"لون", "ألوان"},
        wikidata={property = "P462"}, 
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.inscription()
    return {
        type = "row",
        label = "لافتة",
        value = {"لافتة", "يافطة"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P1684",
            listmax = 1
        }, 
        metadata = {
			description = "النقوش والعلامات والتوقيعات على الموضوع",
			option = "", 
			type = "", 
        }
    }
end

function building.equipment()
    return {
        type = "row",
        description = "التجهيزات التي يتم توفيرها",
        label = "التجهيز",
        plurallabel = "التجهيزات",
        value = {"تجهيز", "التجهيز"},
        wikidata={property = "P912"}, 
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.replaces()
    return general.replaces()
end

function building.replacedby()
    return general.replacedby()
end

function building.visitors()
    return {
        type = "row",
        label = "عدد الزوار سنويا",
        value = {"الزوار", "عدد الزوار سنويا", "زوار"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P1174",
            showDate = "true",
            conjunction = "<br />",
            list = "bestrank"
        }, 
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.protection()
    return {
        type = "row",
        label = "Statut patrimonial",
        value = {"classement", "protection"},
        --wikidata = {property ='P1425'}, 
        metadata = {
			description = "",
			option = "", 
			type = "", 
        }
    }
end

function building.unesco()
    local id = localdata["رقم"]
    if (id == "-") then
        return nil
    end
    if id then
        id = "[http://whc.unesco.org/ar/list/" .. id .. " " .. id .. "]"
    else
        id = wd.formatAndCat {entity = item, property = "P757", urlpattern = "http://whc.unesco.org/ar/list/$1"}
    end
    if (not id) then
        return nil
    end
    return {
        type = "table",
        title = "[[File:World Heritage Emblem.svg|15px|alt=Logo du patrimoine mondial|link=موقع تراث عالمي]] تراث عالمي",
        rows = {
            {type = "row", label = "Désignation", value = "nom unesco"},
            {
                type = "row",
                label = "النوع",
                value = "النوع",
                wikidata = {property = "P1435", targetvalue = {"Q16617071", "Q52683527", "Q52683530"}}, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "السنة",
                value = "السنة",
                wikidata = {
                    property = "P1435",
                    targetvalue = {"Q9259", "Q16617071", "Q52683527", "Q52683530"},
                    showonlyqualifier = {"P580"}
                }, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "رقم التعريف",
                value = function()
                    return id
                end, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {
                type = "row",
                label = "المعايير",
                singularlabel = "المعيار",
                value = function(localdata)
                    if localdata["المعايير"] then
                        return "[http://whc.unesco.org/ar/criteres/" .. localdata["المعايير"] .. "]"
                    end
                end,
                wikidata = function(item)
                    local str, numclaims =
                        wd.formatStatements {
                        entity = item,
                        property = "P2614",
                        link = "-",
                        conjtype = " ",
                        returnnumberofvalues = true
                    }
                    if str then
                        return wd.formatAndCat {
                            value = "[http://whc.unesco.org/ar/criteres/$1 " .. str .. "]",
                            entity = item,
                            property = "P2614"
                        }, numclaims
                    end
                end, 
		        metadata = {
					description = "",
					option = "", 
					type = "", 
		        }
            },
            {type = "row", label = "Surface", value = "surface unesco"},
            {type = "row", label = "Zone tampon", value = "surface zone tampon unesco"}
        }
    }
end

function building.danger()
    return {
        type = "row",
        label = "الخطر",
        plurallabel = "الأخطار",
        value = {"خطر", "danger", "dangers"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P3335",
            listmax = 5
        }, 
        metadata = {
			description = "المخاطر التي يتعرض لها",
			option = "", 
			type = "", 
        }
    }
end

function building.policy()
    return {
        type = "row",
        label = "القانون",
        plurallabel = "القوانين",
        value = {"قانون", "policy"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P5023",
            listmax = 5
        }, 
        metadata = {
			description = "السياسة والقوانين المتبعة",
			option = "", 
			type = "", 
        }
    }
end

function building.geoloc(params)
    return general.geoloc(params)
end

function building.awards()
    return general.awards(params)
end

function building.recordheld()
    return {
        type = "row",
        label = "رقم قياسي",
        plurallabel = "أرقام قياسية",
        value = {"رقم_قياسي", "record"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P1000",
            showDate = "true",
            listmax = 3,
            conjunction = "<br />"
        }, 
        metadata = {
			description = "الأرقام القياسية المسجلة",
			option = "", 
			type = "", 
        }
    }
end

function building.significantEvent()
    return {
        type = "row",
        label = "أحداث مهمة",
        value = {"أحداث", "تواريخ_مهمة", "significant_event", "events"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            formatting = "table",
            property = "P793",
            qualifier1 = "P642",
            qualifier2 = "P585",
            qualifier3 = "P580",
            qualifier4 = "P582",
            rowsubformat1 = "$1 <small>$3</small>",
            rowsubformat2 = "$2 :",
            rowsubformat3 = "<br />($3$4)",
            rowsubformat4 = "&nbsp; - $4",
            rowformat = "* $2 $0 $1 $R0",

            conjunction = "<br />",
            blacklist0 = "Q18752057,Q385378,Q1370468,Q15051339,Q1417098," ..
                "Q125375,Q1306940,Q217102,Q2144402,Q18621193,Q331483," .. "Q17781833,Q6160,Q5135520"
        }, 
        metadata = {
			description = "أهم الأحداث التي شهدها",
			option = "", 
			type = "", 
        }
    }
end

function building.facilities()
    return {
        type = "row", 
        label = "المرافق",
        value = {"مرافق", "facilities"},
        wikidata = {
            wikimod = "Wikidata.Ca",
            property = "P2670",
            formatting = "table",
            qualifier1 = "P1114 OR P31 OR P580 OR P582 OR P149",
            qualifier6 = "P1114",
            qualifier2 = "P31",
            qualifier3 = "P580",
            qualifier4 = "P582",
            qualifier5 = "P149",
            rowsubformat1 = ":<small>$6$2$3$5</small>",
            rowsubformat6 = "&nbsp;العدد $6",
            rowsubformat2 = "<br />&nbsp;$2",
            rowsubformat3 = "<br />&nbsp;(منذ $3$4)",
            rowsubformat4 = "&nbsp; حتى $4",
            rowsubformat5 = "&nbsp;''الطراز المعماري'': $5",
            rowformat = "* '''$0'''$R0 $1"
        },
        metadata = {
			description = "مرافق المبنى الخاصة",
			option = "", 
			type = "string", 
        }
    }
end


return building