import { DatabaseType } from '@/lib/domain/database-type';
import type { Template } from '../templates-data';
import image from '@/assets/templates/adonis-acl.png';
import imageDark from '@/assets/templates/adonis-acl-dark.png';

const now = Date.now();

export const adonisAclDb: Template = {
    slug: 'adonis-acl-database',
    name: 'Adonis Acl Database',
    shortDescription: 'Role based permissions',
    description:
        'Adonis ACL adds role based permissions to built in Auth System of Adonis Framework.',
    image,
    imageDark,
    tags: ['Postgres', 'Open Source', 'Node.js'],
    featured: false,
    url: 'https://github.com/enniel/adonis-acl',
    diagram: {
        id: 'adonis_acl_db',
        name: 'adonis-acl-database',
        createdAt: new Date(),
        updatedAt: new Date(),
        databaseType: DatabaseType.POSTGRESQL,
        tables: [
            {
                id: '4tfy7o1t3ln1373iyxtzpz8t5',
                name: 'permission_user',
                schema: 'public',
                x: 441.0506024096385,
                y: -94.22037476830401,
                fields: [
                    {
                        id: 'kx4al18p0mzdkcnr1lpo6h75n',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        default: "nextval('permission_user_id_seq'::regclass)",
                        createdAt: now,
                    },
                    {
                        id: 'zjbpw5umqxilj7urdfmbsc3oy',
                        name: 'permission_id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'inmxxha9vdpnfeupr788gwfw1',
                        name: 'user_id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'vimawd57a8ft226yznzhts8gh',
                        name: 'created_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: '2fzwubtg6tkpglg9rvej86k73',
                        name: 'updated_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: '1usshdeu8pbxa3l4itt814ldc',
                        name: 'permission_user_permission_id_user_id_key',
                        unique: true,
                        fieldIds: [
                            'zjbpw5umqxilj7urdfmbsc3oy',
                            'inmxxha9vdpnfeupr788gwfw1',
                        ],
                        createdAt: now,
                    },
                    {
                        id: 'o4zsinm8juyrgd318f7thopu2',
                        name: 'idx_permission_user_permission_id',
                        unique: false,
                        fieldIds: ['zjbpw5umqxilj7urdfmbsc3oy'],
                        createdAt: now,
                    },
                    {
                        id: 'oq2qxxzd2n8mphs4lh7jyzjxk',
                        name: 'idx_permission_user_user_id',
                        unique: false,
                        fieldIds: ['inmxxha9vdpnfeupr788gwfw1'],
                        createdAt: now,
                    },
                    {
                        id: 'i60fxthzz9o372y4tbhb5cuhm',
                        name: 'permission_user_pkey',
                        unique: true,
                        fieldIds: ['kx4al18p0mzdkcnr1lpo6h75n'],
                        createdAt: now,
                    },
                ],
                color: '#4dee8a',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
            {
                id: '6v24e5bdz4vi9e757spbcea6d',
                name: 'role_user',
                schema: 'public',
                x: 374.94791473586656,
                y: 337.7814643188136,
                fields: [
                    {
                        id: 'vaaupx4bcejm1kqx4jze9wytx',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        default: "nextval('role_user_id_seq'::regclass)",
                        createdAt: now,
                    },
                    {
                        id: '29dylthvlf2v5vh41dp1kyxbr',
                        name: 'role_id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'g4i6e70u835inwwcjs9tdiwpf',
                        name: 'user_id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: '3tfwqm0igug2j0vm6sv6nt6i5',
                        name: 'created_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'ho7doyax6cr77qpvsboz6jymz',
                        name: 'updated_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: '7ngkqnaew4m8h3ejoxdercox1',
                        name: 'role_user_pkey',
                        unique: true,
                        fieldIds: ['vaaupx4bcejm1kqx4jze9wytx'],
                        createdAt: now,
                    },
                    {
                        id: 'dz3poedtl3z6wkwanxgv98zxi',
                        name: 'role_user_role_id_user_id_key',
                        unique: true,
                        fieldIds: [
                            '29dylthvlf2v5vh41dp1kyxbr',
                            'g4i6e70u835inwwcjs9tdiwpf',
                        ],
                        createdAt: now,
                    },
                    {
                        id: 'l8j5np655am15rgrfja4qzpdt',
                        name: 'idx_role_user_user_id',
                        unique: false,
                        fieldIds: ['g4i6e70u835inwwcjs9tdiwpf'],
                        createdAt: now,
                    },
                    {
                        id: 'ie7wixunsiwfzp8udcpxmsj7p',
                        name: 'idx_role_user_role_id',
                        unique: false,
                        fieldIds: ['29dylthvlf2v5vh41dp1kyxbr'],
                        createdAt: now,
                    },
                ],
                color: '#ffe374',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
            {
                id: 'i298i343vjq652fdswhwaysr7',
                name: 'users',
                schema: 'public',
                x: 90.5794253938833,
                y: 140.8111214087117,
                fields: [
                    {
                        id: 'zs7cvtl01rtle7xts2mwqavg3',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        default: "nextval('users_id_seq'::regclass)",
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: 'vxdig4dza0x7d7k70a8k6m7ap',
                        name: 'users_pkey',
                        unique: true,
                        fieldIds: ['zs7cvtl01rtle7xts2mwqavg3'],
                        createdAt: now,
                    },
                ],
                color: '#8a61f5',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
            {
                id: 'mueqxc4u5k58cz26hqu1ku7sx',
                name: 'permission_role',
                schema: 'public',
                x: 1283.7775718257649,
                y: 56.92159406858201,
                fields: [
                    {
                        id: '8s76u8u0ivylxlhhya7geg3t7',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        default: "nextval('permission_role_id_seq'::regclass)",
                        createdAt: now,
                    },
                    {
                        id: 'jkyfn71uasmxjj22bsxxug6wb',
                        name: 'permission_id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'i1y14qiro8bqu0nhaj4quyd9p',
                        name: 'role_id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 's86pfp5iewn9mwci4m75oro0j',
                        name: 'created_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'v10o7negcp8tliaiie8iste38',
                        name: 'updated_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: '4uhhvnt29q91z55tfpr1uib38',
                        name: 'permission_role_permission_id_role_id_key',
                        unique: true,
                        fieldIds: [
                            'jkyfn71uasmxjj22bsxxug6wb',
                            'i1y14qiro8bqu0nhaj4quyd9p',
                        ],
                        createdAt: now,
                    },
                    {
                        id: '8o6apfea6ifduymoxd0teibi0',
                        name: 'idx_permission_role_role_id',
                        unique: false,
                        fieldIds: ['i1y14qiro8bqu0nhaj4quyd9p'],
                        createdAt: now,
                    },
                    {
                        id: 'lahuo79xsq2brj2dni67hpip1',
                        name: 'idx_permission_role_permission_id',
                        unique: false,
                        fieldIds: ['jkyfn71uasmxjj22bsxxug6wb'],
                        createdAt: now,
                    },
                    {
                        id: '6hqnbyj0uzzxulurr56uak38x',
                        name: 'permission_role_pkey',
                        unique: true,
                        fieldIds: ['8s76u8u0ivylxlhhya7geg3t7'],
                        createdAt: now,
                    },
                ],
                color: '#8eb7ff',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
            {
                id: 't6c4vthncqe0gxza814wuzcjl',
                name: 'permissions',
                schema: 'public',
                x: 877.67859128823,
                y: -156.20315106580168,
                fields: [
                    {
                        id: 'iywp08732p9q7pltm6pqqmmk6',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        default: "nextval('permissions_id_seq'::regclass)",
                        createdAt: now,
                    },
                    {
                        id: 'z9p6x72tx45bfv0iwq64jfobp',
                        name: 'slug',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: true,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'ipix7t0lz3pn78leic3s9xrjy',
                        name: 'name',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'kli69miojwm6e0hseacy8o5hy',
                        name: 'description',
                        type: {
                            id: 'text',
                            name: 'text',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'wjd77kdm6ecdythpwarpvu658',
                        name: 'created_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'h4ir4c21y2uibomt5twrdcqgi',
                        name: 'updated_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: '7wofvazg9gu4z15gazvnu29d2',
                        name: 'permissions_pkey',
                        unique: true,
                        fieldIds: ['iywp08732p9q7pltm6pqqmmk6'],
                        createdAt: now,
                    },
                    {
                        id: 'upxsqobs4g597kbbpfmyqnnkh',
                        name: 'permissions_slug_key',
                        unique: true,
                        fieldIds: ['z9p6x72tx45bfv0iwq64jfobp'],
                        createdAt: now,
                    },
                ],
                color: '#b067e9',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
            {
                id: 'wigyqmreqg7oo1361a4v4tf1o',
                name: 'roles',
                schema: 'public',
                x: 837.7233549582947,
                y: 272.313623725672,
                fields: [
                    {
                        id: 'bz9n3ntxo22bb7mu9t9wwv67x',
                        name: 'id',
                        type: {
                            id: 'integer',
                            name: 'integer',
                        },
                        primaryKey: true,
                        unique: true,
                        nullable: false,
                        default: "nextval('roles_id_seq'::regclass)",
                        createdAt: now,
                    },
                    {
                        id: 'wmrytzy38hipx342qjznsy8zx',
                        name: 'slug',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: true,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'hk3g5yid08iozkvooc4htuabs',
                        name: 'name',
                        type: {
                            id: 'character_varying',
                            name: 'character varying',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: false,
                        createdAt: now,
                    },
                    {
                        id: 'h0gp2hi6nf14dlw0wo14h1gyn',
                        name: 'description',
                        type: {
                            id: 'text',
                            name: 'text',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'd2kwx6qx2cd7epm7m5pikp718',
                        name: 'created_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                    {
                        id: 'xq1udcys21dn8rwn6vatyy47a',
                        name: 'updated_at',
                        type: {
                            id: 'timestamp_with_time_zone',
                            name: 'timestamp with time zone',
                        },
                        primaryKey: false,
                        unique: false,
                        nullable: true,
                        createdAt: now,
                    },
                ],
                indexes: [
                    {
                        id: 'ngrpk9ugw0en5ej20jst3fdj2',
                        name: 'roles_pkey',
                        unique: true,
                        fieldIds: ['bz9n3ntxo22bb7mu9t9wwv67x'],
                        createdAt: now,
                    },
                    {
                        id: '4od6wsi5v258oflij1uw3d43b',
                        name: 'roles_slug_key',
                        unique: true,
                        fieldIds: ['wmrytzy38hipx342qjznsy8zx'],
                        createdAt: now,
                    },
                ],
                color: '#ff6363',
                isView: false,
                isMaterializedView: false,
                createdAt: now,
            },
        ],
        relationships: [
            {
                id: '47fwpcozxyz27e30pm1ib56zm',
                name: 'permission_user_user_id_fkey',
                sourceSchema: 'public',
                targetSchema: 'public',
                sourceTableId: '4tfy7o1t3ln1373iyxtzpz8t5',
                targetTableId: 'i298i343vjq652fdswhwaysr7',
                sourceFieldId: 'inmxxha9vdpnfeupr788gwfw1',
                targetFieldId: 'zs7cvtl01rtle7xts2mwqavg3',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: '9s8jc4cycjn9ql94ncqjzrbec',
                name: 'permission_user_permission_id_fkey',
                sourceSchema: 'public',
                targetSchema: 'public',
                sourceTableId: '4tfy7o1t3ln1373iyxtzpz8t5',
                targetTableId: 't6c4vthncqe0gxza814wuzcjl',
                sourceFieldId: 'zjbpw5umqxilj7urdfmbsc3oy',
                targetFieldId: 'iywp08732p9q7pltm6pqqmmk6',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: 'dmxvyh7b90codoe0aosraa94h',
                name: 'role_user_user_id_fkey',
                sourceSchema: 'public',
                targetSchema: 'public',
                sourceTableId: '6v24e5bdz4vi9e757spbcea6d',
                targetTableId: 'i298i343vjq652fdswhwaysr7',
                sourceFieldId: 'g4i6e70u835inwwcjs9tdiwpf',
                targetFieldId: 'zs7cvtl01rtle7xts2mwqavg3',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: 'f0t9gyglmjmnd5apytli0p9ip',
                name: 'role_user_role_id_fkey',
                sourceSchema: 'public',
                targetSchema: 'public',
                sourceTableId: '6v24e5bdz4vi9e757spbcea6d',
                targetTableId: 'wigyqmreqg7oo1361a4v4tf1o',
                sourceFieldId: '29dylthvlf2v5vh41dp1kyxbr',
                targetFieldId: 'bz9n3ntxo22bb7mu9t9wwv67x',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: 'hpvk9671hn872b3zr4p5fkisr',
                name: 'permission_role_role_id_fkey',
                sourceSchema: 'public',
                targetSchema: 'public',
                sourceTableId: 'mueqxc4u5k58cz26hqu1ku7sx',
                targetTableId: 'wigyqmreqg7oo1361a4v4tf1o',
                sourceFieldId: 'i1y14qiro8bqu0nhaj4quyd9p',
                targetFieldId: 'bz9n3ntxo22bb7mu9t9wwv67x',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
            {
                id: 'lvv365mewcakaozzmwv8qo78c',
                name: 'permission_role_permission_id_fkey',
                sourceSchema: 'public',
                targetSchema: 'public',
                sourceTableId: 'mueqxc4u5k58cz26hqu1ku7sx',
                targetTableId: 't6c4vthncqe0gxza814wuzcjl',
                sourceFieldId: 'jkyfn71uasmxjj22bsxxug6wb',
                targetFieldId: 'iywp08732p9q7pltm6pqqmmk6',
                sourceCardinality: 'many',
                targetCardinality: 'one',
                createdAt: now,
            },
        ],
        dependencies: [],
    },
};
