import {
  type Meta,
  type StoryObj,
  applicationConfig,
  moduleMetadata,
} from '@storybook/angular';
import { provideHttpClient } from '@angular/common/http';

import { DestinationInfoComponent } from '@isa/checkout/shared/product-info';
import { ShippingTarget } from '@isa/checkout/data-access';

const meta: Meta<DestinationInfoComponent> = {
  title: 'checkout/shared/product-info/DestinationInfoComponent',
  component: DestinationInfoComponent,
  decorators: [
    applicationConfig({
      providers: [provideHttpClient()],
    }),
    moduleMetadata({
      imports: [],
      providers: [],
    }),
  ],
};

export default meta;

type Story = StoryObj<DestinationInfoComponent>;

export const Delivery: Story = {
  args: {
    underline: true,
    shoppingCartItem: {
      availability: {
        estimatedDelivery: {
          start: '2024-06-10T00:00:00+02:00',
          stop: '2024-06-12T00:00:00+02:00',
        },
      },
      destination: {
        data: {
          target: ShippingTarget.Delivery,
        },
      },
      features: {
        orderType: 'Versand',
      },
    },
  },
};

export const Pickup: Story = {
  args: {
    shoppingCartItem: {
      availability: {
        estimatedDelivery: {
          start: '2024-06-10T00:00:00+02:00',
          stop: '2024-06-12T00:00:00+02:00',
        },
      },
      destination: {
        data: {
          target: ShippingTarget.Branch,
          targetBranch: {
            data: {
              name: 'Musterfiliale',
              address: {
                street: 'Musterstraße',
                streetNumber: '1',
                zipCode: '12345',
                city: 'Musterstadt',
              },
            },
          },
        },
      },
      features: {
        orderType: 'Abholung',
      },
    },
  },
};

export const InStore: Story = {
  args: {
    shoppingCartItem: {
      availability: {
        estimatedDelivery: {
          start: '2024-06-10T00:00:00+02:00',
          stop: '2024-06-12T00:00:00+02:00',
        },
      },
      destination: {
        data: {
          target: ShippingTarget.Branch,
          targetBranch: {
            data: {
              name: 'Musterfiliale',
              address: {
                street: 'Musterstraße',
                streetNumber: '1',
                zipCode: '12345',
                city: 'Musterstadt',
              },
            },
          },
        },
      },
      features: {
        orderType: 'Rücklage',
      },
    },
  },
};
