import { z } from 'zod';

export let addressSchema = z.object({
    address1: z.string(),
    address2: z.string().optional(),
    zip: z.string().regex(/^\d{5}(-\d{4})?$/),
    state: z.string(),
    city: z.string()
})
export let MEMBER = z.object({
    id: z.number(),
    email: z.string().email(),
    firstName: z.string(),
    lastName: z.string(),
    password: z.string(),
    tokenUsed: z.string().regex(
        /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,
        "Invalid UUID"
    ),
    joined: z.string(),
    address: addressSchema
})

export let NETWORK = z.object({
    id: z.number(),
    name: z.string(),
    apps: z.array(z.string()),
    logo: z.string()
})
.strict()

export let TITLE = z.object({
    id: z.number(),
    name: z.string(),
    apps: z.array(z.string()),
    logo: z.string()
})
.strict()

export let PAYMENT = z.object({
    id: z.number(),
    name: z.string(),
    email: z.string(),
    time: z.string(),
    amount: z.number(),
    product: z.string(),
})

export let POST = z.object({
    id: z.number(),
    text: z.string(),
    time: z.string(),
    sentBy: z.string(),
    edited: z.boolean()
})

export let CONVSRSATION =  z.object({
    id: z.number(),
    between: z.array(z.string()),
    lastUpdated: z.string()
}).strict()

export let DM = z.object({
    id: z.number(),
    conversation: z.string(),
    from: z.string(),
    text: z.string(),
    time: z.string()
}).strict()

export let MEMBER_IN_NETWORK = z.object({
    id: z.number(),
    from: z.string(),
    to: z.string(),
    created: z.string()
}).strict()