import type { CollectionConfig } from 'payload'

export const Submissions: CollectionConfig = {
  slug: 'submissions',
  admin: {
    useAsTitle: 'name',
  },
  fields: [
    {
      name: 'name',
      type: 'text',
      required: true,
    },
    {
      name: 'company',
      type: 'text',
    },
    {
      name: 'email',
      type: 'email',
      required: true,
    },
    {
      name: 'services',
      type: 'select',
      hasMany: true,
      options: [
        { label: 'Web Design & Development', value: 'web' },
        { label: 'Custom Systems', value: 'systems' },
        { label: 'Digital Infrastructure', value: 'infrastructure' },
      ],
    },
    {
      name: 'aiEnhancement',
      type: 'checkbox',
      defaultValue: false,
    },
    {
      name: 'aiType',
      type: 'select',
      options: [
        { label: 'AI Teammate', value: 'teammate' },
        { label: 'Customer-Facing AI', value: 'customer-facing' },
        { label: 'Data Intelligence', value: 'data-intelligence' },
        { label: 'Not Sure Yet', value: 'unsure' },
      ],
      admin: {
        condition: (data) => data?.aiEnhancement,
      },
    },
    {
      name: 'industry',
      type: 'select',
      options: [
        { label: 'Maritime / Yachting', value: 'maritime' },
        { label: 'Hospitality', value: 'hospitality' },
        { label: 'Technology', value: 'technology' },
        { label: 'Real Estate', value: 'real-estate' },
        { label: 'Finance', value: 'finance' },
        { label: 'NGO / Nonprofit', value: 'ngo' },
        { label: 'Other', value: 'other' },
      ],
    },
    {
      name: 'scope',
      type: 'textarea',
    },
    {
      name: 'timeline',
      type: 'select',
      options: [
        { label: 'ASAP', value: 'asap' },
        { label: '1-3 months', value: '1-3-months' },
        { label: '3-6 months', value: '3-6-months' },
        { label: 'Just exploring', value: 'exploring' },
      ],
    },
    {
      name: 'brief',
      type: 'textarea',
      admin: {
        readOnly: true,
        description: 'AI-generated project brief',
      },
    },
  ],
}
