import { CaptionedTimeGroupComponent } from '@app/modules/components/captioned-time-group/captioned-time-group.component';
import { FlightStatusComponent } from '@app/modules/components/flight-status/flight-status.component';
import { PropertyComponent } from '@app/modules/components/property/property.component';
import { TextComponent } from '@toolkit/text/text.component';
import { Meta, moduleMetadata, Story } from '@storybook/angular';
import { TooltipModule } from 'primeng/tooltip';
import {
    FlightTransitionStatus,
    IFlightTransition,
} from '../../../../typings/flight/flight-transition';
import { TimeGroupComponent } from '../time-group/time-group.component';
import { FlightTransitionComponent } from './flight-transition.component';

export default {
    title: 'Components/FlightTransition',
    component: FlightTransitionComponent,
    decorators: [
        moduleMetadata({
            declarations: [
                TextComponent,
                TimeGroupComponent,
                FlightStatusComponent,
                CaptionedTimeGroupComponent,
                PropertyComponent,
            ],
            imports: [TooltipModule],
        }),
    ],
    argTypes: {
        transition: {
            control: 'object',
        },
        title: {
            control: 'text',
        },
        dispatch: {
            options: ['Bus', 'Bridge', 'None'],
            mapping: {
                Bus: 'Bus',
                Bridge: 'Bridge',
                None: undefined,
            },
            control: {
                type: 'select',
                labels: {
                    Bus: 'Bus',
                    Bridge: 'Bridge',
                    None: 'None',
                },
            },
        },
        gate: {
            control: 'text',
        },
        bagBelt: {
            control: 'text',
        },
    },
} as Meta;

const deboarding: IFlightTransition = {
    status: FlightTransitionStatus.SPECIFIED,
    start: {
        utc: '2022-04-08T17:05:00Z',
        local: '2022-04-08T20:08:00+03:03',
        localTime: '20:08',
        tzOffset: 183,
        dayChange: {
            value: 0,
            title: '',
        },
    },
    end: {
        utc: '2022-04-08T17:35:00Z',
        local: '2022-04-08T20:38:00+03:03',
        localTime: '20:38',
        tzOffset: 183,
        dayChange: {
            value: 0,
            title: '',
        },
    },
    isActual: true,
};

export const Default: Story<FlightTransitionComponent> = (args) => {
    return {
        props: args,
    };
};
Default.args = {
    transition: deboarding,
};
