/*
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import {Layout, WordDefinition} from '../domain/layout';

const klokkenEr: WordDefinition = {1: [1, 2, 3, 4, 5, 6, 7, 9, 10]};
const minutter: WordDefinition = {4: [4, 5, 6, 7, 8, 9, 10, 11]};
const i: WordDefinition = {5: [8]};
const over: WordDefinition = {5: [4, 5, 6, 7]};
const fem: WordDefinition = {2: [1, 2, 3]};
const ti: WordDefinition = {4: [1, 2]};
const kvart: WordDefinition = {3: [4, 5, 6, 7, 8]};
const tyve: WordDefinition = {2: [4, 5, 6, 7]};
const halv: WordDefinition = {6: [8, 9, 10, 11]};

export const LayoutDk: Layout = {
    code: 'dk',
    hours: {
        '0,12': {10: [8, 9, 10, 11]},
        '1,13': {7: [1, 2]},
        '2,14': {7: [3, 4]},
        '3,15': {7: [5, 6, 7]},
        '4,16': {7: [8, 9, 10, 11]},
        '5,17': {8: [1, 2, 3]},
        '6,18': {8: [4, 5, 6, 7]},
        '7,19': {8: [9, 10, 11]},
        '8,20': {9: [1, 2, 3, 4]},
        '9,21': {9: [6, 7]},
        '10,22': {9: [10, 11]},
        '11,23': {10: [1, 2, 3, 4, 5, 6]}
    },
    letters: [
        'KLOKKENVERO',
        'FEMTYVESKLA',
        'OJEKVARTVAT',
        'TIAMINUTTER',
        'VEMOVERILMF',
        'MONALISHALV',
        'ETTOTREFIRE',
        'FEMSEKSRSYV',
        'OTTERNIMETI',
        'ELLEVEATOLV'
    ],
    minutes: {
        '5,6,7,8,9': [fem, minutter, over],
        '10,11,12,13,14': [ti, minutter, over],
        '15,16,17,18,19': [kvart, over],
        '20,21,22,23,24': [tyve, minutter, over],
        '25,26,27,28,29': [fem, minutter, i, halv],
        '30,31,32,33,34': [halv],
        '35,36,37,38,39': [fem, minutter, over, halv],
        '40,41,42,43,44': [tyve, minutter, i],
        '45,46,47,48,49': [kvart, i],
        '50,51,52,53,54': [ti, minutter, i],
        '55,56,57,58,59': [fem, minutter, i]
    },
    permanent: klokkenEr,
    prettyName: 'Dansk',
    version: 2
};

declare namespace Fritteli {
    interface Fritteli {
        uhr: Uhr;
    }

    interface Uhr {
        register: (layout: Layout) => void;
    }
}
declare namespace $ {
    const fritteli: Fritteli.Fritteli;
}

$.fritteli.uhr.register(LayoutDk);