module Modules exposing ( Module , all_modules , build_license , download_license , DownloadType(..) , ModuleInfo , module_info , module_property , module_desc , module_sorter ) import Html exposing (Html, text, a) import Html.Attributes exposing (href) import Sort exposing (Sorter) import File.Download as Download type Module = CarbonUnderground | Ecocide | Extractive | BDS | Taliban | Myanmar | XinjiangUygar | UsTariff | Surveillance | Military | LawEnforcement | Media | SocialAuditing | BoardOfDirectors | SupplyChain | Copyleft all_modules : List Module all_modules = [ CarbonUnderground , Ecocide , Extractive , BDS , Taliban , Myanmar , XinjiangUygar , UsTariff , Surveillance , Military , LawEnforcement , Media , SocialAuditing , BoardOfDirectors , SupplyChain , Copyleft ] type alias ModuleInfo = { name: String , desc: List (Html Never) , index: Int } module_info : Module -> ModuleInfo module_info mod = case mod of CarbonUnderground -> { name = "Carbon Underground 200" , desc = [ text """ Disallow use by the top global publicly-owned coal, oil, and gas reserve (judged by """ , a [ href "https://www.ffisolutions.com/research-analytics-index-solutions/research-screening/the-carbon-underground-200/" ] [ text "the FFI Carbon Underground 200)" ] ] , index = 0 } Ecocide -> { name = "Ecocide" , desc = [text "Disallow anyone who knowingly commits widespread or long term ecocide"] , index = 1 } Extractive -> { name = "Extractive Industries" , desc = [text """ Disallow use by anyone involved in fossil fuel / mineral exploitation, extraction, development, and sale """ ] , index = 2 } BDS -> { name = "BDS (Boycott, Divestment, Sanctions)" , desc = [ text "Disallow use by anyone on the " , a [ href "https://bdsmovement.net/" ] [ text "Boycott, Divestment, Sanctions'" ] , text "list" ] , index = 3 } Taliban -> { name = "Taliban" , desc = [text "Disallow use by anyone who trades with, works with, or is the Taliban"] , index = 4 } Myanmar -> { name = "Myanmar" , desc = [ text """ Disallow use by anyone who trades with, works with, or is the Myanmar/Burmese military """ ] , index = 5 } XinjiangUygar -> { name = "Xinjiang Uygur Autonomous Region" , desc = [ text """ Disallow use by anyone who works with or is someone who benefits from goods produced in the Xinjiang Uygur Autonomous Region of China """ ] , index = 6 } UsTariff -> { name = "U.S. Tariff Act" , desc = [ text """ Disallow use by anyone who works with or is someone who the U.S. Customs and Border Protection believes uses forced labor """ ] , index = 7 } Surveillance -> { name = "Mass Surveillance" , desc = [ text """ Disallow use by anyone who works with or is a goverment/multinational corporation who participates in a mass-surveilence program """ ] , index = 8 } Military -> { name = "Military Activities" , desc = [ text """ Disallow use by anyone who works with or is a goverment/multinational corporation who conducts military activities """ ] , index = 9 } LawEnforcement -> { name = "Law Enforcement" , desc = [ text """ Disallow use by anyone who works with or anyone who trades with or offers support to local, state, or federal law enforcement """ ] , index = 10 } Media -> { name = "Media" , desc = [ text """ Disallow use by anyone who is or works with someone who broadcasts messages promoting violence """ ] , index = 11 } SocialAuditing -> { name = "Social Auditing" , desc = [ text """ Require that organizations that use your software only use social auditing methods that adhere to the principles of the """ , a [ href "https://wsr-network.org/what-is-wsr/statement-of-principles/" ] [ text "Worker-Driven Social Responsibility Network," ] , text """ or not use social auditing methods at all """ ] , index = 12 } BoardOfDirectors -> { name = "Workers on Board of Directors" , desc = [ text """ If the organization using your software has a board of directors, require that they have at least 30% of the seats on the board be paid less than twice the amount of the the lowest paid worker in the organization """ ] , index = 13 } SupplyChain -> { name = "Supply Chain Transparency" , desc = [ text """ Require that whoever uses your software must publish information about their supply chain on a public website """ ] , index = 14 } Copyleft -> { name = "Copyleft" , desc = [ text """ Require that any modifications or derivitive works based on your software or source code be licensed under the exact same license """ ] , index = 15 } module_property : (ModuleInfo -> a) -> Module -> a module_property adapter mod = adapter (module_info mod) module_desc : Module -> List (Html a) module_desc mod = module_property .desc mod |> List.map (Html.map never) module_sorter : Sorter Module module_sorter = Sort.by (module_property .index) Sort.increasing -- License Building type DownloadType = Plain | Markdown | Html download_mime : DownloadType -> String download_mime dtype = case dtype of Plain -> "text/plain" Markdown -> "text/markdown" Html -> "text/html" download_ext : DownloadType -> String download_ext dtype = case dtype of Plain -> "txt" Markdown -> "md" Html -> "html" build_license : DownloadType -> List Module -> String build_license dtype modules = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!" download_license : DownloadType -> List Module -> Cmd msg download_license dtype modules = Download.string ("LICENSE." ++ (download_ext dtype)) (download_mime dtype) (build_license dtype modules)