import * as Yup from 'yup';

type ProductCategoryFormSchemaType = {
  code: string;
  name: string;
};

export const ProductCategoryFormSchema: Yup.ObjectSchema<ProductCategoryFormSchemaType> =
  Yup.object({
    code: Yup.string()
      .required('Kode wajib diisi!')
      .max(3, 'Kode kategori produk melebihi 3 karakter!'),
    name: Yup.string()
      .required('Nama wajib diisi!')
      .max(50, 'Nama kategori produk melebihi 50 karakter!'),
  });

export const UpdateProductCategoryFormSchema = ProductCategoryFormSchema;

export type ProductCategoryFormValues = Yup.InferType<
  typeof ProductCategoryFormSchema
>;
